import java.util.Scanner

fun main(args: Array<String>){
	val sc = Scanner(System.`in`)
	val S = sc.nextLine()
	val K = sc.nextLine().toLong()
	val N = S.length
	val A = IntArray(N)
	for(i in 0..N-1){
		A[i] = Integer.parseInt(Character.toString(S[i]))
	}
	
	var f = N+1
	var n = 1

	for(i in 0..N-1){
		if(A[i] != 1){
			n = A[i]
			f = i+1
			break
		}
	}

	if(K<f) println(1)
	else println(n)

}