import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		final long FIVE_QUADRILION = 5000000000000000L;

		Scanner sc = new Scanner(System.in);
		String S = sc.nextLine();
		long K = Long.parseLong(sc.nextLine());

		for(int i=0;i<S.length();i++) {
			int x = Integer.parseInt(S.substring(i, i+1));

			double t = Math.pow(x, FIVE_QUADRILION);

			if( t >= K) {
				System.out.println(x);
				return;
			}else {
				K -= t;
			}
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {

		final long FIVE_QUADRILION = 5000000000000000L;

		Scanner sc = new Scanner(System.in);
		String S = sc.nextLine();
		long K = Long.parseLong(sc.nextLine());

		for(int i=0;i<S.length();i++) {
			int x = Integer.parseInt(S.substring(i, i+1));

			double t = Math.pow(x, FIVE_QUADRILION);

			if( t >= K) {
				System.out.println(x);
				return;
			}else {
				K -= t;
			}
		}
	}
} Main public static void main(String[] args) {

		final long FIVE_QUADRILION = 5000000000000000L;

		Scanner sc = new Scanner(System.in);
		String S = sc.nextLine();
		long K = Long.parseLong(sc.nextLine());

		for(int i=0;i<S.length();i++) {
			int x = Integer.parseInt(S.substring(i, i+1));

			double t = Math.pow(x, FIVE_QUADRILION);

			if( t >= K) {
				System.out.println(x);
				return;
			}else {
				K -= t;
			}
		}
	} main {

		final long FIVE_QUADRILION = 5000000000000000L;

		Scanner sc = new Scanner(System.in);
		String S = sc.nextLine();
		long K = Long.parseLong(sc.nextLine());

		for(int i=0;i<S.length();i++) {
			int x = Integer.parseInt(S.substring(i, i+1));

			double t = Math.pow(x, FIVE_QUADRILION);

			if( t >= K) {
				System.out.println(x);
				return;
			}else {
				K -= t;
			}
		}
	} final long FIVE_QUADRILION = 5000000000000000L; FIVE_QUADRILION 5000000000000000L Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.nextLine(); S sc.nextLine() sc.nextLine sc long K = Long.parseLong(sc.nextLine()); K Long.parseLong(sc.nextLine()) Long.parseLong Long sc.nextLine() sc.nextLine sc for(int i=0;i<S.length();i++) {
			int x = Integer.parseInt(S.substring(i, i+1));

			double t = Math.pow(x, FIVE_QUADRILION);

			if( t >= K) {
				System.out.println(x);
				return;
			}else {
				K -= t;
			}
		} int i=0; int i=0; i 0 i<S.length() i S.length() S.length S i++ i++ i {
			int x = Integer.parseInt(S.substring(i, i+1));

			double t = Math.pow(x, FIVE_QUADRILION);

			if( t >= K) {
				System.out.println(x);
				return;
			}else {
				K -= t;
			}
		} {
			int x = Integer.parseInt(S.substring(i, i+1));

			double t = Math.pow(x, FIVE_QUADRILION);

			if( t >= K) {
				System.out.println(x);
				return;
			}else {
				K -= t;
			}
		} int x = Integer.parseInt(S.substring(i, i+1)); x Integer.parseInt(S.substring(i, i+1)) Integer.parseInt Integer S.substring(i, i+1) S.substring S i i+1 i 1 double t = Math.pow(x, FIVE_QUADRILION); t Math.pow(x, FIVE_QUADRILION) Math.pow Math x FIVE_QUADRILION if( t >= K) {
				System.out.println(x);
				return;
			}else {
				K -= t;
			} t >= K t K {
				System.out.println(x);
				return;
			} System.out.println(x) System.out.println System.out System System.out x return; {
				K -= t;
			} K -= t K t String[] args args public class Main {

	public static void main(String[] args) {

		final long FIVE_QUADRILION = 5000000000000000L;

		Scanner sc = new Scanner(System.in);
		String S = sc.nextLine();
		long K = Long.parseLong(sc.nextLine());

		for(int i=0;i<S.length();i++) {
			int x = Integer.parseInt(S.substring(i, i+1));

			double t = Math.pow(x, FIVE_QUADRILION);

			if( t >= K) {
				System.out.println(x);
				return;
			}else {
				K -= t;
			}
		}
	}
} public class Main {

	public static void main(String[] args) {

		final long FIVE_QUADRILION = 5000000000000000L;

		Scanner sc = new Scanner(System.in);
		String S = sc.nextLine();
		long K = Long.parseLong(sc.nextLine());

		for(int i=0;i<S.length();i++) {
			int x = Integer.parseInt(S.substring(i, i+1));

			double t = Math.pow(x, FIVE_QUADRILION);

			if( t >= K) {
				System.out.println(x);
				return;
			}else {
				K -= t;
			}
		}
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		final long FIVE_QUADRILION = 5000000000000000L;

		Scanner sc = new Scanner(System.in);
		String S = sc.nextLine();
		long K = Long.parseLong(sc.nextLine());

		for(int i=0;i<S.length();i++) {
			int x = Integer.parseInt(S.substring(i, i+1));

			double t = Math.pow(x, FIVE_QUADRILION);

			if( t >= K) {
				System.out.println(x);
				return;
			}else {
				K -= t;
			}
		}
	}
}
