import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);

		String amj=sc.next();
		long s1=0;
		long mojisu=sc.nextLong();
		long mj=0;
		for(int i=0; i<amj.length(); i++) {
			if(amj.charAt(i)!='1') {
				if(s1>0) {
					mj=Long.parseLong(amj.charAt(Math.min(((int)s1) ,amj.length()-1))+"");
				}
				else {
					mj=Long.parseLong(amj.charAt(0)+"");
				}
				break;
			}
			else {
				s1++;
			}
		}

		if(mojisu>s1) {
			System.out.println(mj);
		}
		else {
			System.out.println(1);
		}
	}
} import java.util.Scanner; Scanner java.util class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);

		String amj=sc.next();
		long s1=0;
		long mojisu=sc.nextLong();
		long mj=0;
		for(int i=0; i<amj.length(); i++) {
			if(amj.charAt(i)!='1') {
				if(s1>0) {
					mj=Long.parseLong(amj.charAt(Math.min(((int)s1) ,amj.length()-1))+"");
				}
				else {
					mj=Long.parseLong(amj.charAt(0)+"");
				}
				break;
			}
			else {
				s1++;
			}
		}

		if(mojisu>s1) {
			System.out.println(mj);
		}
		else {
			System.out.println(1);
		}
	}
} Main public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);

		String amj=sc.next();
		long s1=0;
		long mojisu=sc.nextLong();
		long mj=0;
		for(int i=0; i<amj.length(); i++) {
			if(amj.charAt(i)!='1') {
				if(s1>0) {
					mj=Long.parseLong(amj.charAt(Math.min(((int)s1) ,amj.length()-1))+"");
				}
				else {
					mj=Long.parseLong(amj.charAt(0)+"");
				}
				break;
			}
			else {
				s1++;
			}
		}

		if(mojisu>s1) {
			System.out.println(mj);
		}
		else {
			System.out.println(1);
		}
	} main {
		Scanner sc=new Scanner(System.in);

		String amj=sc.next();
		long s1=0;
		long mojisu=sc.nextLong();
		long mj=0;
		for(int i=0; i<amj.length(); i++) {
			if(amj.charAt(i)!='1') {
				if(s1>0) {
					mj=Long.parseLong(amj.charAt(Math.min(((int)s1) ,amj.length()-1))+"");
				}
				else {
					mj=Long.parseLong(amj.charAt(0)+"");
				}
				break;
			}
			else {
				s1++;
			}
		}

		if(mojisu>s1) {
			System.out.println(mj);
		}
		else {
			System.out.println(1);
		}
	} Scanner sc=new Scanner(System.in); sc new Scanner(System.in) String amj=sc.next(); amj sc.next() sc.next sc long s1=0; s1 0 long mojisu=sc.nextLong(); mojisu sc.nextLong() sc.nextLong sc long mj=0; mj 0 for(int i=0; i<amj.length(); i++) {
			if(amj.charAt(i)!='1') {
				if(s1>0) {
					mj=Long.parseLong(amj.charAt(Math.min(((int)s1) ,amj.length()-1))+"");
				}
				else {
					mj=Long.parseLong(amj.charAt(0)+"");
				}
				break;
			}
			else {
				s1++;
			}
		} int i=0; int i=0; i 0 i<amj.length() i amj.length() amj.length amj i++ i++ i {
			if(amj.charAt(i)!='1') {
				if(s1>0) {
					mj=Long.parseLong(amj.charAt(Math.min(((int)s1) ,amj.length()-1))+"");
				}
				else {
					mj=Long.parseLong(amj.charAt(0)+"");
				}
				break;
			}
			else {
				s1++;
			}
		} {
			if(amj.charAt(i)!='1') {
				if(s1>0) {
					mj=Long.parseLong(amj.charAt(Math.min(((int)s1) ,amj.length()-1))+"");
				}
				else {
					mj=Long.parseLong(amj.charAt(0)+"");
				}
				break;
			}
			else {
				s1++;
			}
		} if(amj.charAt(i)!='1') {
				if(s1>0) {
					mj=Long.parseLong(amj.charAt(Math.min(((int)s1) ,amj.length()-1))+"");
				}
				else {
					mj=Long.parseLong(amj.charAt(0)+"");
				}
				break;
			}
			else {
				s1++;
			} amj.charAt(i)!='1' amj.charAt(i) amj.charAt amj i '1' {
				if(s1>0) {
					mj=Long.parseLong(amj.charAt(Math.min(((int)s1) ,amj.length()-1))+"");
				}
				else {
					mj=Long.parseLong(amj.charAt(0)+"");
				}
				break;
			} if(s1>0) {
					mj=Long.parseLong(amj.charAt(Math.min(((int)s1) ,amj.length()-1))+"");
				}
				else {
					mj=Long.parseLong(amj.charAt(0)+"");
				} s1>0 s1 0 {
					mj=Long.parseLong(amj.charAt(Math.min(((int)s1) ,amj.length()-1))+"");
				} mj=Long.parseLong(amj.charAt(Math.min(((int)s1) ,amj.length()-1))+"") mj Long.parseLong(amj.charAt(Math.min(((int)s1) ,amj.length()-1))+"") Long.parseLong Long amj.charAt(Math.min(((int)s1) ,amj.length()-1))+"" amj.charAt(Math.min(((int)s1) ,amj.length()-1)) amj.charAt amj Math.min(((int)s1) ,amj.length()-1) Math.min Math ((int)s1) amj.length()-1 amj.length() amj.length amj 1 "" {
					mj=Long.parseLong(amj.charAt(0)+"");
				} mj=Long.parseLong(amj.charAt(0)+"") mj Long.parseLong(amj.charAt(0)+"") Long.parseLong Long amj.charAt(0)+"" amj.charAt(0) amj.charAt amj 0 "" break; {
				s1++;
			} s1++ s1 if(mojisu>s1) {
			System.out.println(mj);
		}
		else {
			System.out.println(1);
		} mojisu>s1 mojisu s1 {
			System.out.println(mj);
		} System.out.println(mj) System.out.println System.out System System.out mj {
			System.out.println(1);
		} System.out.println(1) System.out.println System.out System System.out 1 String[] args args
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);

		String amj=sc.next();
		long s1=0;
		long mojisu=sc.nextLong();
		long mj=0;
		for(int i=0; i<amj.length(); i++) {
			if(amj.charAt(i)!='1') {
				if(s1>0) {
					mj=Long.parseLong(amj.charAt(Math.min(((int)s1) ,amj.length()-1))+"");
				}
				else {
					mj=Long.parseLong(amj.charAt(0)+"");
				}
				break;
			}
			else {
				s1++;
			}
		}

		if(mojisu>s1) {
			System.out.println(mj);
		}
		else {
			System.out.println(1);
		}
	}
}