import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/*
 * AtCoder Beginner Contest 106 C "To Infinity"
 *   https://abc106.contest.atcoder.jp/tasks/ghi_n/
 */
public class Main {

	public static void main(String[] args) {

		InputScanner in = new InputScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		Task task = new Task();
		task.run(in, out);

		in.close();
		out.close();
	}

	static class Task {

		public void run(InputScanner in, PrintWriter out) {

			String[] S = in.nextStringArray("");
			long K = in.nextLong();

			int ans = 1;
			for (int i = 0; i < S.length; i++) {

				int num = Integer.parseInt(S[i]);

				if (num != 1) {
					if (i + 1 > K) {
						ans = 1;
					} else {
						ans = num;
					}
					break;
				}
			}

			out.println(ans);
		}
	}

	/*
	 * extends java.util.Scanner
	 */
	static class InputScanner {

		Scanner scanner;

		public InputScanner(InputStream inputStream) {
			this.scanner = new Scanner(inputStream);
		}

		public boolean hasNext() {
			return scanner.hasNext();
		}

		public int nextInt() {
			return Integer.parseInt(scanner.next());
		}

		public long nextLong() {
			return Long.parseLong(scanner.next());
		}

		public double nextDouble() {
			return Double.parseDouble(scanner.next());
		}
		public String next() {
			return scanner.next();
		}

		public int[] nextIntArray(int n) {
			int[] ret = new int[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.nextInt();
			}
			return ret;
		}

		public int[][] nextIntArray(int h, int w) {
			int[][] ret = new int[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextInt();
				}
			}
			return ret;
		}

		public long[] nextLongArray(int n) {
			long[] ret = new long[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.nextLong();
			}
			return ret;
		}

		public long[][] nextlongArray(int h, int w) {
			long[][] ret = new long[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextLong();
				}
			}
			return ret;
		}

		public double[] nextDoubleArray(int n) {
			double[] ret = new double[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.nextDouble();
			}
			return ret;
		}

		public double[][] nextDoubleArray(int h, int w) {
			double[][] ret = new double[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextLong();
				}
			}
			return ret;
		}

		public String[] nextStringArray(int n) {
			String[] ret = new String[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.next();
			}
			return ret;
		}

		public String[] nextStringArray(String split) {
			String[] ret = scanner.next().split(split);
			return ret;
		}

		public String[][] nextStringArray(int h, int w) {
			String[][] ret = new String[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.next();
				}
			}
			return ret;
		}

		public String[][] nextStringArray(int h, String split) {
			String[][] ret = new String[h][];
			for (int i = 0; i < h; i++) {
				ret[i] = scanner.next().split(split);
			}
			return ret;
		}

		public void close() {
			scanner.close();
		}

	}

} import java.io.InputStream; InputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {

		InputScanner in = new InputScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		Task task = new Task();
		task.run(in, out);

		in.close();
		out.close();
	}

	static class Task {

		public void run(InputScanner in, PrintWriter out) {

			String[] S = in.nextStringArray("");
			long K = in.nextLong();

			int ans = 1;
			for (int i = 0; i < S.length; i++) {

				int num = Integer.parseInt(S[i]);

				if (num != 1) {
					if (i + 1 > K) {
						ans = 1;
					} else {
						ans = num;
					}
					break;
				}
			}

			out.println(ans);
		}
	}

	/*
	 * extends java.util.Scanner
	 */
	static class InputScanner {

		Scanner scanner;

		public InputScanner(InputStream inputStream) {
			this.scanner = new Scanner(inputStream);
		}

		public boolean hasNext() {
			return scanner.hasNext();
		}

		public int nextInt() {
			return Integer.parseInt(scanner.next());
		}

		public long nextLong() {
			return Long.parseLong(scanner.next());
		}

		public double nextDouble() {
			return Double.parseDouble(scanner.next());
		}
		public String next() {
			return scanner.next();
		}

		public int[] nextIntArray(int n) {
			int[] ret = new int[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.nextInt();
			}
			return ret;
		}

		public int[][] nextIntArray(int h, int w) {
			int[][] ret = new int[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextInt();
				}
			}
			return ret;
		}

		public long[] nextLongArray(int n) {
			long[] ret = new long[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.nextLong();
			}
			return ret;
		}

		public long[][] nextlongArray(int h, int w) {
			long[][] ret = new long[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextLong();
				}
			}
			return ret;
		}

		public double[] nextDoubleArray(int n) {
			double[] ret = new double[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.nextDouble();
			}
			return ret;
		}

		public double[][] nextDoubleArray(int h, int w) {
			double[][] ret = new double[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextLong();
				}
			}
			return ret;
		}

		public String[] nextStringArray(int n) {
			String[] ret = new String[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.next();
			}
			return ret;
		}

		public String[] nextStringArray(String split) {
			String[] ret = scanner.next().split(split);
			return ret;
		}

		public String[][] nextStringArray(int h, int w) {
			String[][] ret = new String[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.next();
				}
			}
			return ret;
		}

		public String[][] nextStringArray(int h, String split) {
			String[][] ret = new String[h][];
			for (int i = 0; i < h; i++) {
				ret[i] = scanner.next().split(split);
			}
			return ret;
		}

		public void close() {
			scanner.close();
		}

	}

} Main public static void main(String[] args) {

		InputScanner in = new InputScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		Task task = new Task();
		task.run(in, out);

		in.close();
		out.close();
	} main {

		InputScanner in = new InputScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		Task task = new Task();
		task.run(in, out);

		in.close();
		out.close();
	} InputScanner in = new InputScanner(System.in); in new InputScanner(System.in) PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) Task task = new Task(); task new Task() task.run(in, out) task.run task in out in.close() in.close in out.close() out.close out String[] args args static class Task {

		public void run(InputScanner in, PrintWriter out) {

			String[] S = in.nextStringArray("");
			long K = in.nextLong();

			int ans = 1;
			for (int i = 0; i < S.length; i++) {

				int num = Integer.parseInt(S[i]);

				if (num != 1) {
					if (i + 1 > K) {
						ans = 1;
					} else {
						ans = num;
					}
					break;
				}
			}

			out.println(ans);
		}
	} Task public void run(InputScanner in, PrintWriter out) {

			String[] S = in.nextStringArray("");
			long K = in.nextLong();

			int ans = 1;
			for (int i = 0; i < S.length; i++) {

				int num = Integer.parseInt(S[i]);

				if (num != 1) {
					if (i + 1 > K) {
						ans = 1;
					} else {
						ans = num;
					}
					break;
				}
			}

			out.println(ans);
		} run {

			String[] S = in.nextStringArray("");
			long K = in.nextLong();

			int ans = 1;
			for (int i = 0; i < S.length; i++) {

				int num = Integer.parseInt(S[i]);

				if (num != 1) {
					if (i + 1 > K) {
						ans = 1;
					} else {
						ans = num;
					}
					break;
				}
			}

			out.println(ans);
		} String[] S = in.nextStringArray(""); S in.nextStringArray("") in.nextStringArray in "" long K = in.nextLong(); K in.nextLong() in.nextLong in int ans = 1; ans 1 for (int i = 0; i < S.length; i++) {

				int num = Integer.parseInt(S[i]);

				if (num != 1) {
					if (i + 1 > K) {
						ans = 1;
					} else {
						ans = num;
					}
					break;
				}
			} int i = 0; int i = 0; i 0 i < S.length i S.length S S.length i++ i++ i {

				int num = Integer.parseInt(S[i]);

				if (num != 1) {
					if (i + 1 > K) {
						ans = 1;
					} else {
						ans = num;
					}
					break;
				}
			} {

				int num = Integer.parseInt(S[i]);

				if (num != 1) {
					if (i + 1 > K) {
						ans = 1;
					} else {
						ans = num;
					}
					break;
				}
			} int num = Integer.parseInt(S[i]); num Integer.parseInt(S[i]) Integer.parseInt Integer S[i] S i if (num != 1) {
					if (i + 1 > K) {
						ans = 1;
					} else {
						ans = num;
					}
					break;
				} num != 1 num 1 {
					if (i + 1 > K) {
						ans = 1;
					} else {
						ans = num;
					}
					break;
				} if (i + 1 > K) {
						ans = 1;
					} else {
						ans = num;
					} i + 1 > K i + 1 i 1 K {
						ans = 1;
					} ans = 1 ans 1 {
						ans = num;
					} ans = num ans num break; out.println(ans) out.println out ans InputScanner in in PrintWriter out out static class InputScanner {

		Scanner scanner;

		public InputScanner(InputStream inputStream) {
			this.scanner = new Scanner(inputStream);
		}

		public boolean hasNext() {
			return scanner.hasNext();
		}

		public int nextInt() {
			return Integer.parseInt(scanner.next());
		}

		public long nextLong() {
			return Long.parseLong(scanner.next());
		}

		public double nextDouble() {
			return Double.parseDouble(scanner.next());
		}
		public String next() {
			return scanner.next();
		}

		public int[] nextIntArray(int n) {
			int[] ret = new int[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.nextInt();
			}
			return ret;
		}

		public int[][] nextIntArray(int h, int w) {
			int[][] ret = new int[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextInt();
				}
			}
			return ret;
		}

		public long[] nextLongArray(int n) {
			long[] ret = new long[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.nextLong();
			}
			return ret;
		}

		public long[][] nextlongArray(int h, int w) {
			long[][] ret = new long[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextLong();
				}
			}
			return ret;
		}

		public double[] nextDoubleArray(int n) {
			double[] ret = new double[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.nextDouble();
			}
			return ret;
		}

		public double[][] nextDoubleArray(int h, int w) {
			double[][] ret = new double[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextLong();
				}
			}
			return ret;
		}

		public String[] nextStringArray(int n) {
			String[] ret = new String[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.next();
			}
			return ret;
		}

		public String[] nextStringArray(String split) {
			String[] ret = scanner.next().split(split);
			return ret;
		}

		public String[][] nextStringArray(int h, int w) {
			String[][] ret = new String[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.next();
				}
			}
			return ret;
		}

		public String[][] nextStringArray(int h, String split) {
			String[][] ret = new String[h][];
			for (int i = 0; i < h; i++) {
				ret[i] = scanner.next().split(split);
			}
			return ret;
		}

		public void close() {
			scanner.close();
		}

	} InputScanner Scanner scanner; scanner public InputScanner(InputStream inputStream) {
			this.scanner = new Scanner(inputStream);
		} InputScanner {
			this.scanner = new Scanner(inputStream);
		} this.scanner = new Scanner(inputStream) this.scanner this this.scanner new Scanner(inputStream) InputStream inputStream inputStream public boolean hasNext() {
			return scanner.hasNext();
		} hasNext {
			return scanner.hasNext();
		} return scanner.hasNext(); scanner.hasNext() scanner.hasNext scanner public int nextInt() {
			return Integer.parseInt(scanner.next());
		} nextInt {
			return Integer.parseInt(scanner.next());
		} return Integer.parseInt(scanner.next()); Integer.parseInt(scanner.next()) Integer.parseInt Integer scanner.next() scanner.next scanner public long nextLong() {
			return Long.parseLong(scanner.next());
		} nextLong {
			return Long.parseLong(scanner.next());
		} return Long.parseLong(scanner.next()); Long.parseLong(scanner.next()) Long.parseLong Long scanner.next() scanner.next scanner public double nextDouble() {
			return Double.parseDouble(scanner.next());
		} nextDouble {
			return Double.parseDouble(scanner.next());
		} return Double.parseDouble(scanner.next()); Double.parseDouble(scanner.next()) Double.parseDouble Double scanner.next() scanner.next scanner public String next() {
			return scanner.next();
		} next {
			return scanner.next();
		} return scanner.next(); scanner.next() scanner.next scanner public int[] nextIntArray(int n) {
			int[] ret = new int[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.nextInt();
			}
			return ret;
		} nextIntArray {
			int[] ret = new int[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.nextInt();
			}
			return ret;
		} int[] ret = new int[n]; ret new int[n] n for (int i = 0; i < n; i++) {
				ret[i] = scanner.nextInt();
			} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
				ret[i] = scanner.nextInt();
			} {
				ret[i] = scanner.nextInt();
			} ret[i] = scanner.nextInt() ret[i] ret i scanner.nextInt() scanner.nextInt scanner return ret; ret int n n public int[][] nextIntArray(int h, int w) {
			int[][] ret = new int[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextInt();
				}
			}
			return ret;
		} nextIntArray {
			int[][] ret = new int[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextInt();
				}
			}
			return ret;
		} int[][] ret = new int[h][w]; ret new int[h][w] h w for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextInt();
				}
			} int i = 0; int i = 0; i 0 i < h i h i++ i++ i {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextInt();
				}
			} {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextInt();
				}
			} for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextInt();
				} int j = 0; int j = 0; j 0 j < w j w j++ j++ j {
					ret[i][j] = scanner.nextInt();
				} {
					ret[i][j] = scanner.nextInt();
				} ret[i][j] = scanner.nextInt() ret[i][j] ret[i] ret i j scanner.nextInt() scanner.nextInt scanner return ret; ret int h h int w w public long[] nextLongArray(int n) {
			long[] ret = new long[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.nextLong();
			}
			return ret;
		} nextLongArray {
			long[] ret = new long[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.nextLong();
			}
			return ret;
		} long[] ret = new long[n]; ret new long[n] n for (int i = 0; i < n; i++) {
				ret[i] = scanner.nextLong();
			} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
				ret[i] = scanner.nextLong();
			} {
				ret[i] = scanner.nextLong();
			} ret[i] = scanner.nextLong() ret[i] ret i scanner.nextLong() scanner.nextLong scanner return ret; ret int n n public long[][] nextlongArray(int h, int w) {
			long[][] ret = new long[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextLong();
				}
			}
			return ret;
		} nextlongArray {
			long[][] ret = new long[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextLong();
				}
			}
			return ret;
		} long[][] ret = new long[h][w]; ret new long[h][w] h w for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextLong();
				}
			} int i = 0; int i = 0; i 0 i < h i h i++ i++ i {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextLong();
				}
			} {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextLong();
				}
			} for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextLong();
				} int j = 0; int j = 0; j 0 j < w j w j++ j++ j {
					ret[i][j] = scanner.nextLong();
				} {
					ret[i][j] = scanner.nextLong();
				} ret[i][j] = scanner.nextLong() ret[i][j] ret[i] ret i j scanner.nextLong() scanner.nextLong scanner return ret; ret int h h int w w public double[] nextDoubleArray(int n) {
			double[] ret = new double[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.nextDouble();
			}
			return ret;
		} nextDoubleArray {
			double[] ret = new double[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.nextDouble();
			}
			return ret;
		} double[] ret = new double[n]; ret new double[n] n for (int i = 0; i < n; i++) {
				ret[i] = scanner.nextDouble();
			} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
				ret[i] = scanner.nextDouble();
			} {
				ret[i] = scanner.nextDouble();
			} ret[i] = scanner.nextDouble() ret[i] ret i scanner.nextDouble() scanner.nextDouble scanner return ret; ret int n n public double[][] nextDoubleArray(int h, int w) {
			double[][] ret = new double[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextLong();
				}
			}
			return ret;
		} nextDoubleArray {
			double[][] ret = new double[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextLong();
				}
			}
			return ret;
		} double[][] ret = new double[h][w]; ret new double[h][w] h w for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextLong();
				}
			} int i = 0; int i = 0; i 0 i < h i h i++ i++ i {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextLong();
				}
			} {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextLong();
				}
			} for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextLong();
				} int j = 0; int j = 0; j 0 j < w j w j++ j++ j {
					ret[i][j] = scanner.nextLong();
				} {
					ret[i][j] = scanner.nextLong();
				} ret[i][j] = scanner.nextLong() ret[i][j] ret[i] ret i j scanner.nextLong() scanner.nextLong scanner return ret; ret int h h int w w public String[] nextStringArray(int n) {
			String[] ret = new String[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.next();
			}
			return ret;
		} nextStringArray {
			String[] ret = new String[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.next();
			}
			return ret;
		} String[] ret = new String[n]; ret new String[n] n for (int i = 0; i < n; i++) {
				ret[i] = scanner.next();
			} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
				ret[i] = scanner.next();
			} {
				ret[i] = scanner.next();
			} ret[i] = scanner.next() ret[i] ret i scanner.next() scanner.next scanner return ret; ret int n n public String[] nextStringArray(String split) {
			String[] ret = scanner.next().split(split);
			return ret;
		} nextStringArray {
			String[] ret = scanner.next().split(split);
			return ret;
		} String[] ret = scanner.next().split(split); ret scanner.next().split(split) scanner.next().split scanner.next() scanner.next scanner split return ret; ret String split split public String[][] nextStringArray(int h, int w) {
			String[][] ret = new String[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.next();
				}
			}
			return ret;
		} nextStringArray {
			String[][] ret = new String[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.next();
				}
			}
			return ret;
		} String[][] ret = new String[h][w]; ret new String[h][w] h w for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.next();
				}
			} int i = 0; int i = 0; i 0 i < h i h i++ i++ i {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.next();
				}
			} {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.next();
				}
			} for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.next();
				} int j = 0; int j = 0; j 0 j < w j w j++ j++ j {
					ret[i][j] = scanner.next();
				} {
					ret[i][j] = scanner.next();
				} ret[i][j] = scanner.next() ret[i][j] ret[i] ret i j scanner.next() scanner.next scanner return ret; ret int h h int w w public String[][] nextStringArray(int h, String split) {
			String[][] ret = new String[h][];
			for (int i = 0; i < h; i++) {
				ret[i] = scanner.next().split(split);
			}
			return ret;
		} nextStringArray {
			String[][] ret = new String[h][];
			for (int i = 0; i < h; i++) {
				ret[i] = scanner.next().split(split);
			}
			return ret;
		} String[][] ret = new String[h][]; ret new String[h][] h for (int i = 0; i < h; i++) {
				ret[i] = scanner.next().split(split);
			} int i = 0; int i = 0; i 0 i < h i h i++ i++ i {
				ret[i] = scanner.next().split(split);
			} {
				ret[i] = scanner.next().split(split);
			} ret[i] = scanner.next().split(split) ret[i] ret i scanner.next().split(split) scanner.next().split scanner.next() scanner.next scanner split return ret; ret int h h String split split public void close() {
			scanner.close();
		} close {
			scanner.close();
		} scanner.close() scanner.close scanner public class Main {

	public static void main(String[] args) {

		InputScanner in = new InputScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		Task task = new Task();
		task.run(in, out);

		in.close();
		out.close();
	}

	static class Task {

		public void run(InputScanner in, PrintWriter out) {

			String[] S = in.nextStringArray("");
			long K = in.nextLong();

			int ans = 1;
			for (int i = 0; i < S.length; i++) {

				int num = Integer.parseInt(S[i]);

				if (num != 1) {
					if (i + 1 > K) {
						ans = 1;
					} else {
						ans = num;
					}
					break;
				}
			}

			out.println(ans);
		}
	}

	/*
	 * extends java.util.Scanner
	 */
	static class InputScanner {

		Scanner scanner;

		public InputScanner(InputStream inputStream) {
			this.scanner = new Scanner(inputStream);
		}

		public boolean hasNext() {
			return scanner.hasNext();
		}

		public int nextInt() {
			return Integer.parseInt(scanner.next());
		}

		public long nextLong() {
			return Long.parseLong(scanner.next());
		}

		public double nextDouble() {
			return Double.parseDouble(scanner.next());
		}
		public String next() {
			return scanner.next();
		}

		public int[] nextIntArray(int n) {
			int[] ret = new int[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.nextInt();
			}
			return ret;
		}

		public int[][] nextIntArray(int h, int w) {
			int[][] ret = new int[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextInt();
				}
			}
			return ret;
		}

		public long[] nextLongArray(int n) {
			long[] ret = new long[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.nextLong();
			}
			return ret;
		}

		public long[][] nextlongArray(int h, int w) {
			long[][] ret = new long[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextLong();
				}
			}
			return ret;
		}

		public double[] nextDoubleArray(int n) {
			double[] ret = new double[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.nextDouble();
			}
			return ret;
		}

		public double[][] nextDoubleArray(int h, int w) {
			double[][] ret = new double[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextLong();
				}
			}
			return ret;
		}

		public String[] nextStringArray(int n) {
			String[] ret = new String[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.next();
			}
			return ret;
		}

		public String[] nextStringArray(String split) {
			String[] ret = scanner.next().split(split);
			return ret;
		}

		public String[][] nextStringArray(int h, int w) {
			String[][] ret = new String[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.next();
				}
			}
			return ret;
		}

		public String[][] nextStringArray(int h, String split) {
			String[][] ret = new String[h][];
			for (int i = 0; i < h; i++) {
				ret[i] = scanner.next().split(split);
			}
			return ret;
		}

		public void close() {
			scanner.close();
		}

	}

} public class Main {

	public static void main(String[] args) {

		InputScanner in = new InputScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		Task task = new Task();
		task.run(in, out);

		in.close();
		out.close();
	}

	static class Task {

		public void run(InputScanner in, PrintWriter out) {

			String[] S = in.nextStringArray("");
			long K = in.nextLong();

			int ans = 1;
			for (int i = 0; i < S.length; i++) {

				int num = Integer.parseInt(S[i]);

				if (num != 1) {
					if (i + 1 > K) {
						ans = 1;
					} else {
						ans = num;
					}
					break;
				}
			}

			out.println(ans);
		}
	}

	/*
	 * extends java.util.Scanner
	 */
	static class InputScanner {

		Scanner scanner;

		public InputScanner(InputStream inputStream) {
			this.scanner = new Scanner(inputStream);
		}

		public boolean hasNext() {
			return scanner.hasNext();
		}

		public int nextInt() {
			return Integer.parseInt(scanner.next());
		}

		public long nextLong() {
			return Long.parseLong(scanner.next());
		}

		public double nextDouble() {
			return Double.parseDouble(scanner.next());
		}
		public String next() {
			return scanner.next();
		}

		public int[] nextIntArray(int n) {
			int[] ret = new int[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.nextInt();
			}
			return ret;
		}

		public int[][] nextIntArray(int h, int w) {
			int[][] ret = new int[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextInt();
				}
			}
			return ret;
		}

		public long[] nextLongArray(int n) {
			long[] ret = new long[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.nextLong();
			}
			return ret;
		}

		public long[][] nextlongArray(int h, int w) {
			long[][] ret = new long[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextLong();
				}
			}
			return ret;
		}

		public double[] nextDoubleArray(int n) {
			double[] ret = new double[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.nextDouble();
			}
			return ret;
		}

		public double[][] nextDoubleArray(int h, int w) {
			double[][] ret = new double[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextLong();
				}
			}
			return ret;
		}

		public String[] nextStringArray(int n) {
			String[] ret = new String[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.next();
			}
			return ret;
		}

		public String[] nextStringArray(String split) {
			String[] ret = scanner.next().split(split);
			return ret;
		}

		public String[][] nextStringArray(int h, int w) {
			String[][] ret = new String[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.next();
				}
			}
			return ret;
		}

		public String[][] nextStringArray(int h, String split) {
			String[][] ret = new String[h][];
			for (int i = 0; i < h; i++) {
				ret[i] = scanner.next().split(split);
			}
			return ret;
		}

		public void close() {
			scanner.close();
		}

	}

} Main
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/*
 * AtCoder Beginner Contest 106 C "To Infinity"
 *   https://abc106.contest.atcoder.jp/tasks/ghi_n/
 */
public class Main {

	public static void main(String[] args) {

		InputScanner in = new InputScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		Task task = new Task();
		task.run(in, out);

		in.close();
		out.close();
	}

	static class Task {

		public void run(InputScanner in, PrintWriter out) {

			String[] S = in.nextStringArray("");
			long K = in.nextLong();

			int ans = 1;
			for (int i = 0; i < S.length; i++) {

				int num = Integer.parseInt(S[i]);

				if (num != 1) {
					if (i + 1 > K) {
						ans = 1;
					} else {
						ans = num;
					}
					break;
				}
			}

			out.println(ans);
		}
	}

	/*
	 * extends java.util.Scanner
	 */
	static class InputScanner {

		Scanner scanner;

		public InputScanner(InputStream inputStream) {
			this.scanner = new Scanner(inputStream);
		}

		public boolean hasNext() {
			return scanner.hasNext();
		}

		public int nextInt() {
			return Integer.parseInt(scanner.next());
		}

		public long nextLong() {
			return Long.parseLong(scanner.next());
		}

		public double nextDouble() {
			return Double.parseDouble(scanner.next());
		}
		public String next() {
			return scanner.next();
		}

		public int[] nextIntArray(int n) {
			int[] ret = new int[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.nextInt();
			}
			return ret;
		}

		public int[][] nextIntArray(int h, int w) {
			int[][] ret = new int[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextInt();
				}
			}
			return ret;
		}

		public long[] nextLongArray(int n) {
			long[] ret = new long[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.nextLong();
			}
			return ret;
		}

		public long[][] nextlongArray(int h, int w) {
			long[][] ret = new long[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextLong();
				}
			}
			return ret;
		}

		public double[] nextDoubleArray(int n) {
			double[] ret = new double[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.nextDouble();
			}
			return ret;
		}

		public double[][] nextDoubleArray(int h, int w) {
			double[][] ret = new double[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextLong();
				}
			}
			return ret;
		}

		public String[] nextStringArray(int n) {
			String[] ret = new String[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.next();
			}
			return ret;
		}

		public String[] nextStringArray(String split) {
			String[] ret = scanner.next().split(split);
			return ret;
		}

		public String[][] nextStringArray(int h, int w) {
			String[][] ret = new String[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.next();
				}
			}
			return ret;
		}

		public String[][] nextStringArray(int h, String split) {
			String[][] ret = new String[h][];
			for (int i = 0; i < h; i++) {
				ret[i] = scanner.next().split(split);
			}
			return ret;
		}

		public void close() {
			scanner.close();
		}

	}

}
