import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		long K = sc.nextLong();
		
		
		
		if (K==1)
			System.out.println((S.charAt(0))-48);
		
		else {
			long digit = 0;
			int b = 0;
			while (digit<K){
				long a = (S.charAt(b))-48;
				
				if (a==1) {
					digit++;
					if (digit>=K)
						break;
					b++;
				}
				else {
					break;
				}
			}
			System.out.println((S.charAt(b))-48);
			
		}
	}

} import java.util.Scanner; Scanner java.util public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		long K = sc.nextLong();
		
		
		
		if (K==1)
			System.out.println((S.charAt(0))-48);
		
		else {
			long digit = 0;
			int b = 0;
			while (digit<K){
				long a = (S.charAt(b))-48;
				
				if (a==1) {
					digit++;
					if (digit>=K)
						break;
					b++;
				}
				else {
					break;
				}
			}
			System.out.println((S.charAt(b))-48);
			
		}
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		long K = sc.nextLong();
		
		
		
		if (K==1)
			System.out.println((S.charAt(0))-48);
		
		else {
			long digit = 0;
			int b = 0;
			while (digit<K){
				long a = (S.charAt(b))-48;
				
				if (a==1) {
					digit++;
					if (digit>=K)
						break;
					b++;
				}
				else {
					break;
				}
			}
			System.out.println((S.charAt(b))-48);
			
		}
	} main {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		long K = sc.nextLong();
		
		
		
		if (K==1)
			System.out.println((S.charAt(0))-48);
		
		else {
			long digit = 0;
			int b = 0;
			while (digit<K){
				long a = (S.charAt(b))-48;
				
				if (a==1) {
					digit++;
					if (digit>=K)
						break;
					b++;
				}
				else {
					break;
				}
			}
			System.out.println((S.charAt(b))-48);
			
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc long K = sc.nextLong(); K sc.nextLong() sc.nextLong sc if (K==1)
			System.out.println((S.charAt(0))-48);
		
		else {
			long digit = 0;
			int b = 0;
			while (digit<K){
				long a = (S.charAt(b))-48;
				
				if (a==1) {
					digit++;
					if (digit>=K)
						break;
					b++;
				}
				else {
					break;
				}
			}
			System.out.println((S.charAt(b))-48);
			
		} K==1 K 1 System.out.println((S.charAt(0))-48) System.out.println System.out System System.out (S.charAt(0))-48 (S.charAt(0)) S.charAt S 0 48 {
			long digit = 0;
			int b = 0;
			while (digit<K){
				long a = (S.charAt(b))-48;
				
				if (a==1) {
					digit++;
					if (digit>=K)
						break;
					b++;
				}
				else {
					break;
				}
			}
			System.out.println((S.charAt(b))-48);
			
		} long digit = 0; digit 0 int b = 0; b 0 while (digit<K){
				long a = (S.charAt(b))-48;
				
				if (a==1) {
					digit++;
					if (digit>=K)
						break;
					b++;
				}
				else {
					break;
				}
			} digit<K digit K {
				long a = (S.charAt(b))-48;
				
				if (a==1) {
					digit++;
					if (digit>=K)
						break;
					b++;
				}
				else {
					break;
				}
			} long a = (S.charAt(b))-48; a (S.charAt(b))-48 (S.charAt(b)) S.charAt S b 48 if (a==1) {
					digit++;
					if (digit>=K)
						break;
					b++;
				}
				else {
					break;
				} a==1 a 1 {
					digit++;
					if (digit>=K)
						break;
					b++;
				} digit++ digit if (digit>=K)
						break; digit>=K digit K break; b++ b {
					break;
				} break; System.out.println((S.charAt(b))-48) System.out.println System.out System System.out (S.charAt(b))-48 (S.charAt(b)) S.charAt S b 48 String[] args args public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		long K = sc.nextLong();
		
		
		
		if (K==1)
			System.out.println((S.charAt(0))-48);
		
		else {
			long digit = 0;
			int b = 0;
			while (digit<K){
				long a = (S.charAt(b))-48;
				
				if (a==1) {
					digit++;
					if (digit>=K)
						break;
					b++;
				}
				else {
					break;
				}
			}
			System.out.println((S.charAt(b))-48);
			
		}
	}

} public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		long K = sc.nextLong();
		
		
		
		if (K==1)
			System.out.println((S.charAt(0))-48);
		
		else {
			long digit = 0;
			int b = 0;
			while (digit<K){
				long a = (S.charAt(b))-48;
				
				if (a==1) {
					digit++;
					if (digit>=K)
						break;
					b++;
				}
				else {
					break;
				}
			}
			System.out.println((S.charAt(b))-48);
			
		}
	}

} Main
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		long K = sc.nextLong();
		
		
		
		if (K==1)
			System.out.println((S.charAt(0))-48);
		
		else {
			long digit = 0;
			int b = 0;
			while (digit<K){
				long a = (S.charAt(b))-48;
				
				if (a==1) {
					digit++;
					if (digit>=K)
						break;
					b++;
				}
				else {
					break;
				}
			}
			System.out.println((S.charAt(b))-48);
			
		}
	}

}
