fun main(args : Array<String>) {
    // 5000000000000000
    // 1000000000000000000
    // a number except 1 is exponencially going to grow.
    // n^5000000000000000 is enough bigger than max(K)
    // so, when there is a first number(that is not 1), the string will be like 111XXXXXXXXXXXXXXXXX(continues...almost inifinitly)

    val S = readLine()!!
    val K = readLine()!!.toLong()

    val index = S.indexOfFirst {
        it != '1'
    }
    if (index == -1) {
        println(S[0])
        return
    }

    if ((K-1) >= index) {
        println(S[index])
    } else {
        println(1)
    }
}