fun main(args: Array<String>) {
    val x = readLine()!!.map { s -> s - '0'}
    val K = readLine()!!.toLong() - 1
    var pos = 0
    for (i in 0 until x.size) {
        if (x[i] > 1) {
            pos = i
            break
        }
    }
    println(if (K < pos) 1 else x[pos])
}