object Main {
    def main(args: Array[String]) {
        val str = scala.io.StdIn.readLine()
        val num = scala.io.StdIn.readLine().toLong

        var count         = 0
        var first_not_num = -1
        for(i <- 0 until str.length()) {
            if(first_not_num == -1) {
                if(str(i) == '1') { count += 1 }
                else              { first_not_num = str(i).toString.toInt }
            }  
        }
        if (count.toLong >= num) println(1)
        else             println(first_not_num)
    }
}