import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = println(solve(new Scanner(System.in)))

  def solve(in: String): String = solve(new Scanner(in))

  def solve(sc: Scanner): String = {
    val S = sc.next
    val K = sc.nextLong

    var i = 0
    while (i < S.length && S(i) == '1') {
      i += 1
    }
    if (K <= i) {
      "1"
    } else {
      S(i).toString
    }
  }
}
