fun main(args:Array<String>) {
	val s= readLine()!!
	val k= readLine()!!.toLong()
	if(s.all{it=='1'}){
		println('1')
	}else if(k<=s.takeWhile {it=='1'}.length){
		println('1')
	}else{
		println(s.first{ it!='1'})
	}
	
}