import java.util.*;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		long k = sc.nextLong();
		int oneCount = 0;
		int nextNum = 0;
		for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i) == '1') {
				oneCount++;
			} else {
				nextNum = s.charAt(i) - '0';
				break;
			}
		}
		if (k <= oneCount) {
			System.out.println(1);
		} else {
			System.out.println(nextNum);
		}
	}
} import java.util.*; util.* java public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		long k = sc.nextLong();
		int oneCount = 0;
		int nextNum = 0;
		for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i) == '1') {
				oneCount++;
			} else {
				nextNum = s.charAt(i) - '0';
				break;
			}
		}
		if (k <= oneCount) {
			System.out.println(1);
		} else {
			System.out.println(nextNum);
		}
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		long k = sc.nextLong();
		int oneCount = 0;
		int nextNum = 0;
		for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i) == '1') {
				oneCount++;
			} else {
				nextNum = s.charAt(i) - '0';
				break;
			}
		}
		if (k <= oneCount) {
			System.out.println(1);
		} else {
			System.out.println(nextNum);
		}
	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		long k = sc.nextLong();
		int oneCount = 0;
		int nextNum = 0;
		for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i) == '1') {
				oneCount++;
			} else {
				nextNum = s.charAt(i) - '0';
				break;
			}
		}
		if (k <= oneCount) {
			System.out.println(1);
		} else {
			System.out.println(nextNum);
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc long k = sc.nextLong(); k sc.nextLong() sc.nextLong sc int oneCount = 0; oneCount 0 int nextNum = 0; nextNum 0 for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i) == '1') {
				oneCount++;
			} else {
				nextNum = s.charAt(i) - '0';
				break;
			}
		} int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
			if (s.charAt(i) == '1') {
				oneCount++;
			} else {
				nextNum = s.charAt(i) - '0';
				break;
			}
		} {
			if (s.charAt(i) == '1') {
				oneCount++;
			} else {
				nextNum = s.charAt(i) - '0';
				break;
			}
		} if (s.charAt(i) == '1') {
				oneCount++;
			} else {
				nextNum = s.charAt(i) - '0';
				break;
			} s.charAt(i) == '1' s.charAt(i) s.charAt s i '1' {
				oneCount++;
			} oneCount++ oneCount {
				nextNum = s.charAt(i) - '0';
				break;
			} nextNum = s.charAt(i) - '0' nextNum s.charAt(i) - '0' s.charAt(i) s.charAt s i '0' break; if (k <= oneCount) {
			System.out.println(1);
		} else {
			System.out.println(nextNum);
		} k <= oneCount k oneCount {
			System.out.println(1);
		} System.out.println(1) System.out.println System.out System System.out 1 {
			System.out.println(nextNum);
		} System.out.println(nextNum) System.out.println System.out System System.out nextNum String[] args args public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		long k = sc.nextLong();
		int oneCount = 0;
		int nextNum = 0;
		for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i) == '1') {
				oneCount++;
			} else {
				nextNum = s.charAt(i) - '0';
				break;
			}
		}
		if (k <= oneCount) {
			System.out.println(1);
		} else {
			System.out.println(nextNum);
		}
	}
} public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		long k = sc.nextLong();
		int oneCount = 0;
		int nextNum = 0;
		for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i) == '1') {
				oneCount++;
			} else {
				nextNum = s.charAt(i) - '0';
				break;
			}
		}
		if (k <= oneCount) {
			System.out.println(1);
		} else {
			System.out.println(nextNum);
		}
	}
} Main
import java.util.*;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		long k = sc.nextLong();
		int oneCount = 0;
		int nextNum = 0;
		for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i) == '1') {
				oneCount++;
			} else {
				nextNum = s.charAt(i) - '0';
				break;
			}
		}
		if (k <= oneCount) {
			System.out.println(1);
		} else {
			System.out.println(nextNum);
		}
	}
}
