object Main extends App{
    val s = scala.io.StdIn.readLine.toList
    val t = scala.io.StdIn.readLong

    var cnt = 0
    var flag = true
    var ans = 1

    for(i<-0 until s.size){
    	if(s(i) == '1'){
    		cnt += 1
    	}else if(flag){
    		ans = s(i).toString.toInt
    		flag = false
    	}
    }

    if(cnt < t){
    	println(ans)
    }else{
    	println(1)
    }
}