
object Main extends App {
  
  val sc = new java.util.Scanner(System.in)
  val s = sc.next()
  val k = sc.nextLong()
  val i = s.indexWhere(_ != '1')
  if (i == -1) {
    println(s.head)
  } else if (i <= k) {
    println(s(i))
  } else {
    println(1)
  }
}
