
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			String s = sc.nextLine();
			long k = sc.nextLong();

			for (char c : s.toCharArray()) {
				if (c == '1') {
					k--;
				} else {
					System.out.println(c);
					return;
				}
				if (k <= 0) {
					System.out.println(c);
					return;
				}
			}
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			String s = sc.nextLine();
			long k = sc.nextLong();

			for (char c : s.toCharArray()) {
				if (c == '1') {
					k--;
				} else {
					System.out.println(c);
					return;
				}
				if (k <= 0) {
					System.out.println(c);
					return;
				}
			}
		}
	}
} Main public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			String s = sc.nextLine();
			long k = sc.nextLong();

			for (char c : s.toCharArray()) {
				if (c == '1') {
					k--;
				} else {
					System.out.println(c);
					return;
				}
				if (k <= 0) {
					System.out.println(c);
					return;
				}
			}
		}
	} main {
		try (Scanner sc = new Scanner(System.in)) {
			String s = sc.nextLine();
			long k = sc.nextLong();

			for (char c : s.toCharArray()) {
				if (c == '1') {
					k--;
				} else {
					System.out.println(c);
					return;
				}
				if (k <= 0) {
					System.out.println(c);
					return;
				}
			}
		}
	} try (Scanner sc = new Scanner(System.in)) {
			String s = sc.nextLine();
			long k = sc.nextLong();

			for (char c : s.toCharArray()) {
				if (c == '1') {
					k--;
				} else {
					System.out.println(c);
					return;
				}
				if (k <= 0) {
					System.out.println(c);
					return;
				}
			}
		} {
			String s = sc.nextLine();
			long k = sc.nextLong();

			for (char c : s.toCharArray()) {
				if (c == '1') {
					k--;
				} else {
					System.out.println(c);
					return;
				}
				if (k <= 0) {
					System.out.println(c);
					return;
				}
			}
		} Scanner sc = new Scanner(System.in) Scanner sc = new Scanner(System.in) new Scanner(System.in) String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc long k = sc.nextLong(); k sc.nextLong() sc.nextLong sc for (char c : s.toCharArray()) {
				if (c == '1') {
					k--;
				} else {
					System.out.println(c);
					return;
				}
				if (k <= 0) {
					System.out.println(c);
					return;
				}
			} char c s.toCharArray() s.toCharArray s {
				if (c == '1') {
					k--;
				} else {
					System.out.println(c);
					return;
				}
				if (k <= 0) {
					System.out.println(c);
					return;
				}
			} {
				if (c == '1') {
					k--;
				} else {
					System.out.println(c);
					return;
				}
				if (k <= 0) {
					System.out.println(c);
					return;
				}
			} if (c == '1') {
					k--;
				} else {
					System.out.println(c);
					return;
				} c == '1' c '1' {
					k--;
				} k-- k {
					System.out.println(c);
					return;
				} System.out.println(c) System.out.println System.out System System.out c return; if (k <= 0) {
					System.out.println(c);
					return;
				} k <= 0 k 0 {
					System.out.println(c);
					return;
				} System.out.println(c) System.out.println System.out System System.out c return; String[] args args public class Main {

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			String s = sc.nextLine();
			long k = sc.nextLong();

			for (char c : s.toCharArray()) {
				if (c == '1') {
					k--;
				} else {
					System.out.println(c);
					return;
				}
				if (k <= 0) {
					System.out.println(c);
					return;
				}
			}
		}
	}
} public class Main {

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			String s = sc.nextLine();
			long k = sc.nextLong();

			for (char c : s.toCharArray()) {
				if (c == '1') {
					k--;
				} else {
					System.out.println(c);
					return;
				}
				if (k <= 0) {
					System.out.println(c);
					return;
				}
			}
		}
	}
} Main

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			String s = sc.nextLine();
			long k = sc.nextLong();

			for (char c : s.toCharArray()) {
				if (c == '1') {
					k--;
				} else {
					System.out.println(c);
					return;
				}
				if (k <= 0) {
					System.out.println(c);
					return;
				}
			}
		}
	}
}
