// C - To Infinity
// https://abc106.contest.atcoder.jp/tasks/abc106_c

import scala.io.StdIn.readLine

object Main extends App {

  val s = readLine.toCharArray
  val k = BigInt(readLine)

  def solve(k: BigInt, i: Int = 0): Char = {
    if (s(i) != '1' || k == 1) s(i)
    else solve(k-1, i+1)
  }

  val num = solve(k)

  println(num)

}