import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		new Main().run();
	}

	void run() {
		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();
		long K = sc.nextLong();
		long cur = 5000L * (long) 1e12;
		for (int i = 0; i < str.length(); ++i) {
			long v = str.charAt(i) - '0';
			if (v == 1) {
				--K;
				if (K == 0) {
					System.out.println(v);
					return;
				}
			} else {
				System.out.println(v);
				return;
			}
		}

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

	public static void main(String[] args) {
		new Main().run();
	}

	void run() {
		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();
		long K = sc.nextLong();
		long cur = 5000L * (long) 1e12;
		for (int i = 0; i < str.length(); ++i) {
			long v = str.charAt(i) - '0';
			if (v == 1) {
				--K;
				if (K == 0) {
					System.out.println(v);
					return;
				}
			} else {
				System.out.println(v);
				return;
			}
		}

	}
} Main public static void main(String[] args) {
		new Main().run();
	} main {
		new Main().run();
	} new Main().run() new Main().run new Main() String[] args args void run() {
		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();
		long K = sc.nextLong();
		long cur = 5000L * (long) 1e12;
		for (int i = 0; i < str.length(); ++i) {
			long v = str.charAt(i) - '0';
			if (v == 1) {
				--K;
				if (K == 0) {
					System.out.println(v);
					return;
				}
			} else {
				System.out.println(v);
				return;
			}
		}

	} run {
		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();
		long K = sc.nextLong();
		long cur = 5000L * (long) 1e12;
		for (int i = 0; i < str.length(); ++i) {
			long v = str.charAt(i) - '0';
			if (v == 1) {
				--K;
				if (K == 0) {
					System.out.println(v);
					return;
				}
			} else {
				System.out.println(v);
				return;
			}
		}

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str = sc.nextLine(); str sc.nextLine() sc.nextLine sc long K = sc.nextLong(); K sc.nextLong() sc.nextLong sc long cur = 5000L * (long) 1e12; cur 5000L * (long) 1e12 5000L (long) 1e12 for (int i = 0; i < str.length(); ++i) {
			long v = str.charAt(i) - '0';
			if (v == 1) {
				--K;
				if (K == 0) {
					System.out.println(v);
					return;
				}
			} else {
				System.out.println(v);
				return;
			}
		} int i = 0; int i = 0; i 0 i < str.length() i str.length() str.length str ++i ++i i {
			long v = str.charAt(i) - '0';
			if (v == 1) {
				--K;
				if (K == 0) {
					System.out.println(v);
					return;
				}
			} else {
				System.out.println(v);
				return;
			}
		} {
			long v = str.charAt(i) - '0';
			if (v == 1) {
				--K;
				if (K == 0) {
					System.out.println(v);
					return;
				}
			} else {
				System.out.println(v);
				return;
			}
		} long v = str.charAt(i) - '0'; v str.charAt(i) - '0' str.charAt(i) str.charAt str i '0' if (v == 1) {
				--K;
				if (K == 0) {
					System.out.println(v);
					return;
				}
			} else {
				System.out.println(v);
				return;
			} v == 1 v 1 {
				--K;
				if (K == 0) {
					System.out.println(v);
					return;
				}
			} --K K if (K == 0) {
					System.out.println(v);
					return;
				} K == 0 K 0 {
					System.out.println(v);
					return;
				} System.out.println(v) System.out.println System.out System System.out v return; {
				System.out.println(v);
				return;
			} System.out.println(v) System.out.println System.out System System.out v return;
import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		new Main().run();
	}

	void run() {
		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();
		long K = sc.nextLong();
		long cur = 5000L * (long) 1e12;
		for (int i = 0; i < str.length(); ++i) {
			long v = str.charAt(i) - '0';
			if (v == 1) {
				--K;
				if (K == 0) {
					System.out.println(v);
					return;
				}
			} else {
				System.out.println(v);
				return;
			}
		}

	}
}
