import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String S = scan.next();
		long K = scan.nextLong();
		scan.close();
		int l = S.length();
		int []num = new int[S.length()];
		for(int i = 0; i < l; i++) {
			num[i] = Integer.parseInt(S.substring(i, i + 1));
		}
//		long[]k = new long[S.length()];
		long sum = l;
		if(sum >= K) {
			int cnt1 = 0;
			for(int i = 0; i < l; i++) {
				if(num[i] == 1) {
					cnt1++;
				}else {
					break;
				}
			}
			if(cnt1 >= K) {
				System.out.println(1);
				System.exit(0);
			}
		}
		long cnt = 1;

		int ans = 0;
		for(int i = 0; i < l; i++) {
			if(num[i] != 1) {
				ans = num[i];
				break;
			}
		}
		System.out.println(ans);

	}
} import java.util.Scanner; Scanner java.util public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String S = scan.next();
		long K = scan.nextLong();
		scan.close();
		int l = S.length();
		int []num = new int[S.length()];
		for(int i = 0; i < l; i++) {
			num[i] = Integer.parseInt(S.substring(i, i + 1));
		}
//		long[]k = new long[S.length()];
		long sum = l;
		if(sum >= K) {
			int cnt1 = 0;
			for(int i = 0; i < l; i++) {
				if(num[i] == 1) {
					cnt1++;
				}else {
					break;
				}
			}
			if(cnt1 >= K) {
				System.out.println(1);
				System.exit(0);
			}
		}
		long cnt = 1;

		int ans = 0;
		for(int i = 0; i < l; i++) {
			if(num[i] != 1) {
				ans = num[i];
				break;
			}
		}
		System.out.println(ans);

	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String S = scan.next();
		long K = scan.nextLong();
		scan.close();
		int l = S.length();
		int []num = new int[S.length()];
		for(int i = 0; i < l; i++) {
			num[i] = Integer.parseInt(S.substring(i, i + 1));
		}
//		long[]k = new long[S.length()];
		long sum = l;
		if(sum >= K) {
			int cnt1 = 0;
			for(int i = 0; i < l; i++) {
				if(num[i] == 1) {
					cnt1++;
				}else {
					break;
				}
			}
			if(cnt1 >= K) {
				System.out.println(1);
				System.exit(0);
			}
		}
		long cnt = 1;

		int ans = 0;
		for(int i = 0; i < l; i++) {
			if(num[i] != 1) {
				ans = num[i];
				break;
			}
		}
		System.out.println(ans);

	} main {
		Scanner scan = new Scanner(System.in);
		String S = scan.next();
		long K = scan.nextLong();
		scan.close();
		int l = S.length();
		int []num = new int[S.length()];
		for(int i = 0; i < l; i++) {
			num[i] = Integer.parseInt(S.substring(i, i + 1));
		}
//		long[]k = new long[S.length()];
		long sum = l;
		if(sum >= K) {
			int cnt1 = 0;
			for(int i = 0; i < l; i++) {
				if(num[i] == 1) {
					cnt1++;
				}else {
					break;
				}
			}
			if(cnt1 >= K) {
				System.out.println(1);
				System.exit(0);
			}
		}
		long cnt = 1;

		int ans = 0;
		for(int i = 0; i < l; i++) {
			if(num[i] != 1) {
				ans = num[i];
				break;
			}
		}
		System.out.println(ans);

	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String S = scan.next(); S scan.next() scan.next scan long K = scan.nextLong(); K scan.nextLong() scan.nextLong scan scan.close() scan.close scan int l = S.length(); l S.length() S.length S int []num = new int[S.length()]; num new int[S.length()] S.length() S.length S for(int i = 0; i < l; i++) {
			num[i] = Integer.parseInt(S.substring(i, i + 1));
		} int i = 0; int i = 0; i 0 i < l i l i++ i++ i {
			num[i] = Integer.parseInt(S.substring(i, i + 1));
		} {
			num[i] = Integer.parseInt(S.substring(i, i + 1));
		} num[i] = Integer.parseInt(S.substring(i, i + 1)) num[i] num i Integer.parseInt(S.substring(i, i + 1)) Integer.parseInt Integer S.substring(i, i + 1) S.substring S i i + 1 i 1 long sum = l; sum l if(sum >= K) {
			int cnt1 = 0;
			for(int i = 0; i < l; i++) {
				if(num[i] == 1) {
					cnt1++;
				}else {
					break;
				}
			}
			if(cnt1 >= K) {
				System.out.println(1);
				System.exit(0);
			}
		} sum >= K sum K {
			int cnt1 = 0;
			for(int i = 0; i < l; i++) {
				if(num[i] == 1) {
					cnt1++;
				}else {
					break;
				}
			}
			if(cnt1 >= K) {
				System.out.println(1);
				System.exit(0);
			}
		} int cnt1 = 0; cnt1 0 for(int i = 0; i < l; i++) {
				if(num[i] == 1) {
					cnt1++;
				}else {
					break;
				}
			} int i = 0; int i = 0; i 0 i < l i l i++ i++ i {
				if(num[i] == 1) {
					cnt1++;
				}else {
					break;
				}
			} {
				if(num[i] == 1) {
					cnt1++;
				}else {
					break;
				}
			} if(num[i] == 1) {
					cnt1++;
				}else {
					break;
				} num[i] == 1 num[i] num i 1 {
					cnt1++;
				} cnt1++ cnt1 {
					break;
				} break; if(cnt1 >= K) {
				System.out.println(1);
				System.exit(0);
			} cnt1 >= K cnt1 K {
				System.out.println(1);
				System.exit(0);
			} System.out.println(1) System.out.println System.out System System.out 1 System.exit(0) System.exit System 0 long cnt = 1; cnt 1 int ans = 0; ans 0 for(int i = 0; i < l; i++) {
			if(num[i] != 1) {
				ans = num[i];
				break;
			}
		} int i = 0; int i = 0; i 0 i < l i l i++ i++ i {
			if(num[i] != 1) {
				ans = num[i];
				break;
			}
		} {
			if(num[i] != 1) {
				ans = num[i];
				break;
			}
		} if(num[i] != 1) {
				ans = num[i];
				break;
			} num[i] != 1 num[i] num i 1 {
				ans = num[i];
				break;
			} ans = num[i] ans num[i] num i break; System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String S = scan.next();
		long K = scan.nextLong();
		scan.close();
		int l = S.length();
		int []num = new int[S.length()];
		for(int i = 0; i < l; i++) {
			num[i] = Integer.parseInt(S.substring(i, i + 1));
		}
//		long[]k = new long[S.length()];
		long sum = l;
		if(sum >= K) {
			int cnt1 = 0;
			for(int i = 0; i < l; i++) {
				if(num[i] == 1) {
					cnt1++;
				}else {
					break;
				}
			}
			if(cnt1 >= K) {
				System.out.println(1);
				System.exit(0);
			}
		}
		long cnt = 1;

		int ans = 0;
		for(int i = 0; i < l; i++) {
			if(num[i] != 1) {
				ans = num[i];
				break;
			}
		}
		System.out.println(ans);

	}
} public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String S = scan.next();
		long K = scan.nextLong();
		scan.close();
		int l = S.length();
		int []num = new int[S.length()];
		for(int i = 0; i < l; i++) {
			num[i] = Integer.parseInt(S.substring(i, i + 1));
		}
//		long[]k = new long[S.length()];
		long sum = l;
		if(sum >= K) {
			int cnt1 = 0;
			for(int i = 0; i < l; i++) {
				if(num[i] == 1) {
					cnt1++;
				}else {
					break;
				}
			}
			if(cnt1 >= K) {
				System.out.println(1);
				System.exit(0);
			}
		}
		long cnt = 1;

		int ans = 0;
		for(int i = 0; i < l; i++) {
			if(num[i] != 1) {
				ans = num[i];
				break;
			}
		}
		System.out.println(ans);

	}
} Main
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String S = scan.next();
		long K = scan.nextLong();
		scan.close();
		int l = S.length();
		int []num = new int[S.length()];
		for(int i = 0; i < l; i++) {
			num[i] = Integer.parseInt(S.substring(i, i + 1));
		}
//		long[]k = new long[S.length()];
		long sum = l;
		if(sum >= K) {
			int cnt1 = 0;
			for(int i = 0; i < l; i++) {
				if(num[i] == 1) {
					cnt1++;
				}else {
					break;
				}
			}
			if(cnt1 >= K) {
				System.out.println(1);
				System.exit(0);
			}
		}
		long cnt = 1;

		int ans = 0;
		for(int i = 0; i < l; i++) {
			if(num[i] != 1) {
				ans = num[i];
				break;
			}
		}
		System.out.println(ans);

	}
}