import java.util.Scanner

val sc = Scanner(System.`in`)

fun main(args : Array<String>) {
    val s = sc.next()!!
    val k = sc.nextLong()

    val count1 = s.takeWhile { it == '1' }.length

    if (k <= count1) {
        println(1)
        return
    }

    val nextChar = s.first { it != '1' }
    println(nextChar)
}