import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String S = in.next();
		long K = in.nextLong();
		int ans = 1;
		for (int i = 0; i < Math.min(S.length(), K); i++) {
			if (S.charAt(i) >= '2') {
				ans = S.charAt(i) - '0';
				break;
			}
		}
		System.out.println(ans);
		in.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String S = in.next();
		long K = in.nextLong();
		int ans = 1;
		for (int i = 0; i < Math.min(S.length(), K); i++) {
			if (S.charAt(i) >= '2') {
				ans = S.charAt(i) - '0';
				break;
			}
		}
		System.out.println(ans);
		in.close();
	}
} Main public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String S = in.next();
		long K = in.nextLong();
		int ans = 1;
		for (int i = 0; i < Math.min(S.length(), K); i++) {
			if (S.charAt(i) >= '2') {
				ans = S.charAt(i) - '0';
				break;
			}
		}
		System.out.println(ans);
		in.close();
	} main {
		Scanner in = new Scanner(System.in);
		String S = in.next();
		long K = in.nextLong();
		int ans = 1;
		for (int i = 0; i < Math.min(S.length(), K); i++) {
			if (S.charAt(i) >= '2') {
				ans = S.charAt(i) - '0';
				break;
			}
		}
		System.out.println(ans);
		in.close();
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) String S = in.next(); S in.next() in.next in long K = in.nextLong(); K in.nextLong() in.nextLong in int ans = 1; ans 1 for (int i = 0; i < Math.min(S.length(), K); i++) {
			if (S.charAt(i) >= '2') {
				ans = S.charAt(i) - '0';
				break;
			}
		} int i = 0; int i = 0; i 0 i < Math.min(S.length(), K) i Math.min(S.length(), K) Math.min Math S.length() S.length S K i++ i++ i {
			if (S.charAt(i) >= '2') {
				ans = S.charAt(i) - '0';
				break;
			}
		} {
			if (S.charAt(i) >= '2') {
				ans = S.charAt(i) - '0';
				break;
			}
		} if (S.charAt(i) >= '2') {
				ans = S.charAt(i) - '0';
				break;
			} S.charAt(i) >= '2' S.charAt(i) S.charAt S i '2' {
				ans = S.charAt(i) - '0';
				break;
			} ans = S.charAt(i) - '0' ans S.charAt(i) - '0' S.charAt(i) S.charAt S i '0' break; System.out.println(ans) System.out.println System.out System System.out ans in.close() in.close in String[] args args public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String S = in.next();
		long K = in.nextLong();
		int ans = 1;
		for (int i = 0; i < Math.min(S.length(), K); i++) {
			if (S.charAt(i) >= '2') {
				ans = S.charAt(i) - '0';
				break;
			}
		}
		System.out.println(ans);
		in.close();
	}
} public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String S = in.next();
		long K = in.nextLong();
		int ans = 1;
		for (int i = 0; i < Math.min(S.length(), K); i++) {
			if (S.charAt(i) >= '2') {
				ans = S.charAt(i) - '0';
				break;
			}
		}
		System.out.println(ans);
		in.close();
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String S = in.next();
		long K = in.nextLong();
		int ans = 1;
		for (int i = 0; i < Math.min(S.length(), K); i++) {
			if (S.charAt(i) >= '2') {
				ans = S.charAt(i) - '0';
				break;
			}
		}
		System.out.println(ans);
		in.close();
	}
}