fun main(args: Array<String>) {

    val N = 5000000000000000L
    val S = readLine()!!
    val K = readLine()!!.toLong()

    var count = 0L
    for (c in S) {
        if (c == '1') {
            count++
        }else{
            println(c)
            return
        }
        if (K == count) {
            println(1)
            return
        }
    }

}