import java.io.*;
public class Main {

	public static void main(String[] args)throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		String A = br.readLine();
		long B = Long.parseLong(br.readLine());
		String ans = "1";
		long count = 0;
		for(int i =0; i<A.length(); i++) {
			String sub = A.substring(i,i+1);
			if(A.substring(i,i+1).equals("1")) {
				count++;
			}
		
		
			else if(!sub.equals("1")) {
				ans = sub;
				break;
			}
		}
		if(count>=B) {
			System.out.println("1");
		}
		else {
			System.out.println(ans);
		}
	}

} import java.io.*; io.* java public class Main {

	public static void main(String[] args)throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		String A = br.readLine();
		long B = Long.parseLong(br.readLine());
		String ans = "1";
		long count = 0;
		for(int i =0; i<A.length(); i++) {
			String sub = A.substring(i,i+1);
			if(A.substring(i,i+1).equals("1")) {
				count++;
			}
		
		
			else if(!sub.equals("1")) {
				ans = sub;
				break;
			}
		}
		if(count>=B) {
			System.out.println("1");
		}
		else {
			System.out.println(ans);
		}
	}

} Main public static void main(String[] args)throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		String A = br.readLine();
		long B = Long.parseLong(br.readLine());
		String ans = "1";
		long count = 0;
		for(int i =0; i<A.length(); i++) {
			String sub = A.substring(i,i+1);
			if(A.substring(i,i+1).equals("1")) {
				count++;
			}
		
		
			else if(!sub.equals("1")) {
				ans = sub;
				break;
			}
		}
		if(count>=B) {
			System.out.println("1");
		}
		else {
			System.out.println(ans);
		}
	} main {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		String A = br.readLine();
		long B = Long.parseLong(br.readLine());
		String ans = "1";
		long count = 0;
		for(int i =0; i<A.length(); i++) {
			String sub = A.substring(i,i+1);
			if(A.substring(i,i+1).equals("1")) {
				count++;
			}
		
		
			else if(!sub.equals("1")) {
				ans = sub;
				break;
			}
		}
		if(count>=B) {
			System.out.println("1");
		}
		else {
			System.out.println(ans);
		}
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String A = br.readLine(); A br.readLine() br.readLine br long B = Long.parseLong(br.readLine()); B Long.parseLong(br.readLine()) Long.parseLong Long br.readLine() br.readLine br String ans = "1"; ans "1" long count = 0; count 0 for(int i =0; i<A.length(); i++) {
			String sub = A.substring(i,i+1);
			if(A.substring(i,i+1).equals("1")) {
				count++;
			}
		
		
			else if(!sub.equals("1")) {
				ans = sub;
				break;
			}
		} int i =0; int i =0; i 0 i<A.length() i A.length() A.length A i++ i++ i {
			String sub = A.substring(i,i+1);
			if(A.substring(i,i+1).equals("1")) {
				count++;
			}
		
		
			else if(!sub.equals("1")) {
				ans = sub;
				break;
			}
		} {
			String sub = A.substring(i,i+1);
			if(A.substring(i,i+1).equals("1")) {
				count++;
			}
		
		
			else if(!sub.equals("1")) {
				ans = sub;
				break;
			}
		} String sub = A.substring(i,i+1); sub A.substring(i,i+1) A.substring A i i+1 i 1 if(A.substring(i,i+1).equals("1")) {
				count++;
			}
		
		
			else if(!sub.equals("1")) {
				ans = sub;
				break;
			} A.substring(i,i+1).equals("1") A.substring(i,i+1).equals A.substring(i,i+1) A.substring A i i+1 i 1 "1" {
				count++;
			} count++ count if(!sub.equals("1")) {
				ans = sub;
				break;
			} !sub.equals("1") sub.equals("1") sub.equals sub "1" {
				ans = sub;
				break;
			} ans = sub ans sub break; if(count>=B) {
			System.out.println("1");
		}
		else {
			System.out.println(ans);
		} count>=B count B {
			System.out.println("1");
		} System.out.println("1") System.out.println System.out System System.out "1" {
			System.out.println(ans);
		} System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

	public static void main(String[] args)throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		String A = br.readLine();
		long B = Long.parseLong(br.readLine());
		String ans = "1";
		long count = 0;
		for(int i =0; i<A.length(); i++) {
			String sub = A.substring(i,i+1);
			if(A.substring(i,i+1).equals("1")) {
				count++;
			}
		
		
			else if(!sub.equals("1")) {
				ans = sub;
				break;
			}
		}
		if(count>=B) {
			System.out.println("1");
		}
		else {
			System.out.println(ans);
		}
	}

} public class Main {

	public static void main(String[] args)throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		String A = br.readLine();
		long B = Long.parseLong(br.readLine());
		String ans = "1";
		long count = 0;
		for(int i =0; i<A.length(); i++) {
			String sub = A.substring(i,i+1);
			if(A.substring(i,i+1).equals("1")) {
				count++;
			}
		
		
			else if(!sub.equals("1")) {
				ans = sub;
				break;
			}
		}
		if(count>=B) {
			System.out.println("1");
		}
		else {
			System.out.println(ans);
		}
	}

} Main
import java.io.*;
public class Main {

	public static void main(String[] args)throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		String A = br.readLine();
		long B = Long.parseLong(br.readLine());
		String ans = "1";
		long count = 0;
		for(int i =0; i<A.length(); i++) {
			String sub = A.substring(i,i+1);
			if(A.substring(i,i+1).equals("1")) {
				count++;
			}
		
		
			else if(!sub.equals("1")) {
				ans = sub;
				break;
			}
		}
		if(count>=B) {
			System.out.println("1");
		}
		else {
			System.out.println(ans);
		}
	}

}
