import java.util.Scanner;

public class Main {

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

	    String S = scanner.next();
	    long K = Long.parseLong(scanner.next());

	    int index = 0;
	    char cr= '1';
	    for (int i=0; i<S.length(); i++) {
	        char c = S.charAt(i);
	        if(c == '1') {
	        	c++;
	        } else {
	        	cr=c;
	        	index=i;
	        	break;
	        }
	    }

        if(K-1 >= index) {
        	System.out.print(cr);
        } else {
        	System.out.print('1');
        }

	}

} import java.util.Scanner; Scanner java.util public class Main {

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

	    String S = scanner.next();
	    long K = Long.parseLong(scanner.next());

	    int index = 0;
	    char cr= '1';
	    for (int i=0; i<S.length(); i++) {
	        char c = S.charAt(i);
	        if(c == '1') {
	        	c++;
	        } else {
	        	cr=c;
	        	index=i;
	        	break;
	        }
	    }

        if(K-1 >= index) {
        	System.out.print(cr);
        } else {
        	System.out.print('1');
        }

	}

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

	    String S = scanner.next();
	    long K = Long.parseLong(scanner.next());

	    int index = 0;
	    char cr= '1';
	    for (int i=0; i<S.length(); i++) {
	        char c = S.charAt(i);
	        if(c == '1') {
	        	c++;
	        } else {
	        	cr=c;
	        	index=i;
	        	break;
	        }
	    }

        if(K-1 >= index) {
        	System.out.print(cr);
        } else {
        	System.out.print('1');
        }

	} main {
	    Scanner scanner = new Scanner(System.in);

	    String S = scanner.next();
	    long K = Long.parseLong(scanner.next());

	    int index = 0;
	    char cr= '1';
	    for (int i=0; i<S.length(); i++) {
	        char c = S.charAt(i);
	        if(c == '1') {
	        	c++;
	        } else {
	        	cr=c;
	        	index=i;
	        	break;
	        }
	    }

        if(K-1 >= index) {
        	System.out.print(cr);
        } else {
        	System.out.print('1');
        }

	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String S = scanner.next(); S scanner.next() scanner.next scanner long K = Long.parseLong(scanner.next()); K Long.parseLong(scanner.next()) Long.parseLong Long scanner.next() scanner.next scanner int index = 0; index 0 char cr= '1'; cr '1' for (int i=0; i<S.length(); i++) {
	        char c = S.charAt(i);
	        if(c == '1') {
	        	c++;
	        } else {
	        	cr=c;
	        	index=i;
	        	break;
	        }
	    } int i=0; int i=0; i 0 i<S.length() i S.length() S.length S i++ i++ i {
	        char c = S.charAt(i);
	        if(c == '1') {
	        	c++;
	        } else {
	        	cr=c;
	        	index=i;
	        	break;
	        }
	    } {
	        char c = S.charAt(i);
	        if(c == '1') {
	        	c++;
	        } else {
	        	cr=c;
	        	index=i;
	        	break;
	        }
	    } char c = S.charAt(i); c S.charAt(i) S.charAt S i if(c == '1') {
	        	c++;
	        } else {
	        	cr=c;
	        	index=i;
	        	break;
	        } c == '1' c '1' {
	        	c++;
	        } c++ c {
	        	cr=c;
	        	index=i;
	        	break;
	        } cr=c cr c index=i index i break; if(K-1 >= index) {
        	System.out.print(cr);
        } else {
        	System.out.print('1');
        } K-1 >= index K-1 K 1 index {
        	System.out.print(cr);
        } System.out.print(cr) System.out.print System.out System System.out cr {
        	System.out.print('1');
        } System.out.print('1') System.out.print System.out System System.out '1' String[] args args public class Main {

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

	    String S = scanner.next();
	    long K = Long.parseLong(scanner.next());

	    int index = 0;
	    char cr= '1';
	    for (int i=0; i<S.length(); i++) {
	        char c = S.charAt(i);
	        if(c == '1') {
	        	c++;
	        } else {
	        	cr=c;
	        	index=i;
	        	break;
	        }
	    }

        if(K-1 >= index) {
        	System.out.print(cr);
        } else {
        	System.out.print('1');
        }

	}

} public class Main {

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

	    String S = scanner.next();
	    long K = Long.parseLong(scanner.next());

	    int index = 0;
	    char cr= '1';
	    for (int i=0; i<S.length(); i++) {
	        char c = S.charAt(i);
	        if(c == '1') {
	        	c++;
	        } else {
	        	cr=c;
	        	index=i;
	        	break;
	        }
	    }

        if(K-1 >= index) {
        	System.out.print(cr);
        } else {
        	System.out.print('1');
        }

	}

} Main
import java.util.Scanner;

public class Main {

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

	    String S = scanner.next();
	    long K = Long.parseLong(scanner.next());

	    int index = 0;
	    char cr= '1';
	    for (int i=0; i<S.length(); i++) {
	        char c = S.charAt(i);
	        if(c == '1') {
	        	c++;
	        } else {
	        	cr=c;
	        	index=i;
	        	break;
	        }
	    }

        if(K-1 >= index) {
        	System.out.print(cr);
        } else {
        	System.out.print('1');
        }

	}

}