import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputReader in = new InputReader(System.in);
		PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), true);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.flush();
		out.close();
	}
}

class Pair {
	int first;
	int second;
	int pos;

	Pair(int first, int second, int pos) {
		this.first = first;
		this.second = second;
		this.pos = pos;
	}
}

class TaskB {

	public void solve(int testNumber, InputReader in, PrintWriter pw) {
		String S = in.next();
		long K = in.nextLong();
		char arr[] = S.toCharArray();
		long len = 0;
		int ans = -1;
		for (int i = 0; i < arr.length; i++) {
			int num = arr[i] - '0';
			len += Math.pow(num, 5e15);
			if (len >= K) {
				ans = num;
				break;
			}
		}
		pw.println(ans);

	}

	int __gcd(int a, int b) {
		if (b == 0)
			return a;
		return __gcd(b, a % b);

	}

	public int getInt(int num) {
		int ret = -1;
		switch (num) {
		case 0:
			ret = 6;
			break;
		case 1:
			ret = 2;
			break;
		case 2:
			ret = 5;
			break;
		case 3:
			ret = 5;
			break;
		case 4:
			ret = 4;
			break;
		case 5:
			ret = 5;
			break;
		case 6:
			ret = 6;
			break;
		case 7:
			ret = 3;
			break;
		case 8:
			ret = 7;
			break;
		case 9:
			ret = 6;
			break;
		}
		return ret;
	}

	public int isPow(long num) {
		int count = 0;
		while (num > 0) {
			num /= 2;
			count++;
		}
		return count;
	}
}

class InputReader {
	BufferedReader br;
	StringTokenizer st;

	public InputReader(InputStream in) {
		br = new BufferedReader(new InputStreamReader(in));
		st = null;
	}

	public String next() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return st.nextToken();
	}

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

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

	public double nextDouble() {
		return Double.parseDouble(next());
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.BufferedWriter; BufferedWriter java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.OutputStreamWriter; OutputStreamWriter java.io import java.io.PrintWriter; PrintWriter java.io import java.util.StringTokenizer; StringTokenizer java.util public class Main {
	public static void main(String[] args) {
		InputReader in = new InputReader(System.in);
		PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), true);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.flush();
		out.close();
	}
} Main public static void main(String[] args) {
		InputReader in = new InputReader(System.in);
		PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), true);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.flush();
		out.close();
	} main {
		InputReader in = new InputReader(System.in);
		PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), true);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.flush();
		out.close();
	} InputReader in = new InputReader(System.in); in new InputReader(System.in) PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), true); out new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), true) TaskB solver = new TaskB(); solver new TaskB() solver.solve(1, in, out) solver.solve solver 1 in out out.flush() out.flush out out.close() out.close out String[] args args class Pair {
	int first;
	int second;
	int pos;

	Pair(int first, int second, int pos) {
		this.first = first;
		this.second = second;
		this.pos = pos;
	}
} Pair int first; first int second; second int pos; pos Pair(int first, int second, int pos) {
		this.first = first;
		this.second = second;
		this.pos = pos;
	} Pair {
		this.first = first;
		this.second = second;
		this.pos = pos;
	} this.first = first this.first this this.first first this.second = second this.second this this.second second this.pos = pos this.pos this this.pos pos int first first int second second int pos pos class TaskB {

	public void solve(int testNumber, InputReader in, PrintWriter pw) {
		String S = in.next();
		long K = in.nextLong();
		char arr[] = S.toCharArray();
		long len = 0;
		int ans = -1;
		for (int i = 0; i < arr.length; i++) {
			int num = arr[i] - '0';
			len += Math.pow(num, 5e15);
			if (len >= K) {
				ans = num;
				break;
			}
		}
		pw.println(ans);

	}

	int __gcd(int a, int b) {
		if (b == 0)
			return a;
		return __gcd(b, a % b);

	}

	public int getInt(int num) {
		int ret = -1;
		switch (num) {
		case 0:
			ret = 6;
			break;
		case 1:
			ret = 2;
			break;
		case 2:
			ret = 5;
			break;
		case 3:
			ret = 5;
			break;
		case 4:
			ret = 4;
			break;
		case 5:
			ret = 5;
			break;
		case 6:
			ret = 6;
			break;
		case 7:
			ret = 3;
			break;
		case 8:
			ret = 7;
			break;
		case 9:
			ret = 6;
			break;
		}
		return ret;
	}

	public int isPow(long num) {
		int count = 0;
		while (num > 0) {
			num /= 2;
			count++;
		}
		return count;
	}
} TaskB public void solve(int testNumber, InputReader in, PrintWriter pw) {
		String S = in.next();
		long K = in.nextLong();
		char arr[] = S.toCharArray();
		long len = 0;
		int ans = -1;
		for (int i = 0; i < arr.length; i++) {
			int num = arr[i] - '0';
			len += Math.pow(num, 5e15);
			if (len >= K) {
				ans = num;
				break;
			}
		}
		pw.println(ans);

	} solve {
		String S = in.next();
		long K = in.nextLong();
		char arr[] = S.toCharArray();
		long len = 0;
		int ans = -1;
		for (int i = 0; i < arr.length; i++) {
			int num = arr[i] - '0';
			len += Math.pow(num, 5e15);
			if (len >= K) {
				ans = num;
				break;
			}
		}
		pw.println(ans);

	} String S = in.next(); S in.next() in.next in long K = in.nextLong(); K in.nextLong() in.nextLong in char arr[] = S.toCharArray(); arr S.toCharArray() S.toCharArray S long len = 0; len 0 int ans = -1; ans -1 1 for (int i = 0; i < arr.length; i++) {
			int num = arr[i] - '0';
			len += Math.pow(num, 5e15);
			if (len >= K) {
				ans = num;
				break;
			}
		} int i = 0; int i = 0; i 0 i < arr.length i arr.length arr arr.length i++ i++ i {
			int num = arr[i] - '0';
			len += Math.pow(num, 5e15);
			if (len >= K) {
				ans = num;
				break;
			}
		} {
			int num = arr[i] - '0';
			len += Math.pow(num, 5e15);
			if (len >= K) {
				ans = num;
				break;
			}
		} int num = arr[i] - '0'; num arr[i] - '0' arr[i] arr i '0' len += Math.pow(num, 5e15) len Math.pow(num, 5e15) Math.pow Math num 5e15 if (len >= K) {
				ans = num;
				break;
			} len >= K len K {
				ans = num;
				break;
			} ans = num ans num break; pw.println(ans) pw.println pw ans int testNumber testNumber InputReader in in PrintWriter pw pw int __gcd(int a, int b) {
		if (b == 0)
			return a;
		return __gcd(b, a % b);

	} __gcd {
		if (b == 0)
			return a;
		return __gcd(b, a % b);

	} if (b == 0)
			return a; b == 0 b 0 return a; a return __gcd(b, a % b); __gcd(b, a % b) __gcd b a % b a b int a a int b b public int getInt(int num) {
		int ret = -1;
		switch (num) {
		case 0:
			ret = 6;
			break;
		case 1:
			ret = 2;
			break;
		case 2:
			ret = 5;
			break;
		case 3:
			ret = 5;
			break;
		case 4:
			ret = 4;
			break;
		case 5:
			ret = 5;
			break;
		case 6:
			ret = 6;
			break;
		case 7:
			ret = 3;
			break;
		case 8:
			ret = 7;
			break;
		case 9:
			ret = 6;
			break;
		}
		return ret;
	} getInt {
		int ret = -1;
		switch (num) {
		case 0:
			ret = 6;
			break;
		case 1:
			ret = 2;
			break;
		case 2:
			ret = 5;
			break;
		case 3:
			ret = 5;
			break;
		case 4:
			ret = 4;
			break;
		case 5:
			ret = 5;
			break;
		case 6:
			ret = 6;
			break;
		case 7:
			ret = 3;
			break;
		case 8:
			ret = 7;
			break;
		case 9:
			ret = 6;
			break;
		}
		return ret;
	} int ret = -1; ret -1 1 switch (num) {
		case 0:
			ret = 6;
			break;
		case 1:
			ret = 2;
			break;
		case 2:
			ret = 5;
			break;
		case 3:
			ret = 5;
			break;
		case 4:
			ret = 4;
			break;
		case 5:
			ret = 5;
			break;
		case 6:
			ret = 6;
			break;
		case 7:
			ret = 3;
			break;
		case 8:
			ret = 7;
			break;
		case 9:
			ret = 6;
			break;
		} num case 0: 0 case 0: ret = 6 ret 6 break; case 1: 1 case 1: ret = 2 ret 2 break; case 2: 2 case 2: ret = 5 ret 5 break; case 3: 3 case 3: ret = 5 ret 5 break; case 4: 4 case 4: ret = 4 ret 4 break; case 5: 5 case 5: ret = 5 ret 5 break; case 6: 6 case 6: ret = 6 ret 6 break; case 7: 7 case 7: ret = 3 ret 3 break; case 8: 8 case 8: ret = 7 ret 7 break; case 9: 9 case 9: ret = 6 ret 6 break; return ret; ret int num num public int isPow(long num) {
		int count = 0;
		while (num > 0) {
			num /= 2;
			count++;
		}
		return count;
	} isPow {
		int count = 0;
		while (num > 0) {
			num /= 2;
			count++;
		}
		return count;
	} int count = 0; count 0 while (num > 0) {
			num /= 2;
			count++;
		} num > 0 num 0 {
			num /= 2;
			count++;
		} num /= 2 num 2 count++ count return count; count long num num class InputReader {
	BufferedReader br;
	StringTokenizer st;

	public InputReader(InputStream in) {
		br = new BufferedReader(new InputStreamReader(in));
		st = null;
	}

	public String next() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return st.nextToken();
	}

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

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

	public double nextDouble() {
		return Double.parseDouble(next());
	}
} InputReader BufferedReader br; br StringTokenizer st; st public InputReader(InputStream in) {
		br = new BufferedReader(new InputStreamReader(in));
		st = null;
	} InputReader {
		br = new BufferedReader(new InputStreamReader(in));
		st = null;
	} br = new BufferedReader(new InputStreamReader(in)) br new BufferedReader(new InputStreamReader(in)) st = null st null InputStream in in public String next() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return st.nextToken();
	} next {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return st.nextToken();
	} while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		} st == null || !st.hasMoreTokens() st == null st null !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		} try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			} catch (IOException e) {
				throw new RuntimeException(e);
			} IOException e {
				throw new RuntimeException(e);
			} throw new RuntimeException(e); new RuntimeException(e) {
				st = new StringTokenizer(br.readLine());
			} st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return st.nextToken(); st.nextToken() st.nextToken st public int nextInt() {
		return Integer.parseInt(next());
	} nextInt {
		return Integer.parseInt(next());
	} return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next public long nextLong() {
		return Long.parseLong(next());
	} nextLong {
		return Long.parseLong(next());
	} return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next public double nextDouble() {
		return Double.parseDouble(next());
	} nextDouble {
		return Double.parseDouble(next());
	} return Double.parseDouble(next()); Double.parseDouble(next()) Double.parseDouble Double next() next public class Main {
	public static void main(String[] args) {
		InputReader in = new InputReader(System.in);
		PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), true);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.flush();
		out.close();
	}
} public class Main {
	public static void main(String[] args) {
		InputReader in = new InputReader(System.in);
		PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), true);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.flush();
		out.close();
	}
} Main
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputReader in = new InputReader(System.in);
		PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), true);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.flush();
		out.close();
	}
}

class Pair {
	int first;
	int second;
	int pos;

	Pair(int first, int second, int pos) {
		this.first = first;
		this.second = second;
		this.pos = pos;
	}
}

class TaskB {

	public void solve(int testNumber, InputReader in, PrintWriter pw) {
		String S = in.next();
		long K = in.nextLong();
		char arr[] = S.toCharArray();
		long len = 0;
		int ans = -1;
		for (int i = 0; i < arr.length; i++) {
			int num = arr[i] - '0';
			len += Math.pow(num, 5e15);
			if (len >= K) {
				ans = num;
				break;
			}
		}
		pw.println(ans);

	}

	int __gcd(int a, int b) {
		if (b == 0)
			return a;
		return __gcd(b, a % b);

	}

	public int getInt(int num) {
		int ret = -1;
		switch (num) {
		case 0:
			ret = 6;
			break;
		case 1:
			ret = 2;
			break;
		case 2:
			ret = 5;
			break;
		case 3:
			ret = 5;
			break;
		case 4:
			ret = 4;
			break;
		case 5:
			ret = 5;
			break;
		case 6:
			ret = 6;
			break;
		case 7:
			ret = 3;
			break;
		case 8:
			ret = 7;
			break;
		case 9:
			ret = 6;
			break;
		}
		return ret;
	}

	public int isPow(long num) {
		int count = 0;
		while (num > 0) {
			num /= 2;
			count++;
		}
		return count;
	}
}

class InputReader {
	BufferedReader br;
	StringTokenizer st;

	public InputReader(InputStream in) {
		br = new BufferedReader(new InputStreamReader(in));
		st = null;
	}

	public String next() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return st.nextToken();
	}

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

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

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