fun main(args: Array<String>) {
    val S = readInputLine().toCharArray()
    
    val K = readInputLine().toLong()
    
    for ((i, c) in S.withIndex()) {
        if (c != '1') {
            println(c)
            return
        }
        if (i.toLong() + 1L == K) {
            break
        }
    }
    
    println(1)
}

fun readInputLine(): String {
    return readLine()!!
}
