import java.util.*;

public class Main{
	public static void main(String[] argc){
    	Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String tmp = sc.next();
        long K = Long.parseLong(tmp);

        if(s.length() == 1){
            System.out.println(s);
            return;
        }

        for(int i=0;i<s.length();i++){
            if(s.charAt(i) != '1'){
                if(K < i+1){
                    System.out.println(1);
                    return;
                }else{
                    System.out.println(s.charAt(i));
                    return;
                }
            }
        }

        System.out.println(1);

    }
} import java.util.*; util.* java public class Main{
	public static void main(String[] argc){
    	Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String tmp = sc.next();
        long K = Long.parseLong(tmp);

        if(s.length() == 1){
            System.out.println(s);
            return;
        }

        for(int i=0;i<s.length();i++){
            if(s.charAt(i) != '1'){
                if(K < i+1){
                    System.out.println(1);
                    return;
                }else{
                    System.out.println(s.charAt(i));
                    return;
                }
            }
        }

        System.out.println(1);

    }
} Main public static void main(String[] argc){
    	Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String tmp = sc.next();
        long K = Long.parseLong(tmp);

        if(s.length() == 1){
            System.out.println(s);
            return;
        }

        for(int i=0;i<s.length();i++){
            if(s.charAt(i) != '1'){
                if(K < i+1){
                    System.out.println(1);
                    return;
                }else{
                    System.out.println(s.charAt(i));
                    return;
                }
            }
        }

        System.out.println(1);

    } main {
    	Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String tmp = sc.next();
        long K = Long.parseLong(tmp);

        if(s.length() == 1){
            System.out.println(s);
            return;
        }

        for(int i=0;i<s.length();i++){
            if(s.charAt(i) != '1'){
                if(K < i+1){
                    System.out.println(1);
                    return;
                }else{
                    System.out.println(s.charAt(i));
                    return;
                }
            }
        }

        System.out.println(1);

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String tmp = sc.next(); tmp sc.next() sc.next sc long K = Long.parseLong(tmp); K Long.parseLong(tmp) Long.parseLong Long tmp if(s.length() == 1){
            System.out.println(s);
            return;
        } s.length() == 1 s.length() s.length s 1 {
            System.out.println(s);
            return;
        } System.out.println(s) System.out.println System.out System System.out s return; for(int i=0;i<s.length();i++){
            if(s.charAt(i) != '1'){
                if(K < i+1){
                    System.out.println(1);
                    return;
                }else{
                    System.out.println(s.charAt(i));
                    return;
                }
            }
        } 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'){
                if(K < i+1){
                    System.out.println(1);
                    return;
                }else{
                    System.out.println(s.charAt(i));
                    return;
                }
            }
        } {
            if(s.charAt(i) != '1'){
                if(K < i+1){
                    System.out.println(1);
                    return;
                }else{
                    System.out.println(s.charAt(i));
                    return;
                }
            }
        } if(s.charAt(i) != '1'){
                if(K < i+1){
                    System.out.println(1);
                    return;
                }else{
                    System.out.println(s.charAt(i));
                    return;
                }
            } s.charAt(i) != '1' s.charAt(i) s.charAt s i '1' {
                if(K < i+1){
                    System.out.println(1);
                    return;
                }else{
                    System.out.println(s.charAt(i));
                    return;
                }
            } if(K < i+1){
                    System.out.println(1);
                    return;
                }else{
                    System.out.println(s.charAt(i));
                    return;
                } K < i+1 K i+1 i 1 {
                    System.out.println(1);
                    return;
                } System.out.println(1) System.out.println System.out System System.out 1 return; {
                    System.out.println(s.charAt(i));
                    return;
                } System.out.println(s.charAt(i)) System.out.println System.out System System.out s.charAt(i) s.charAt s i return; System.out.println(1) System.out.println System.out System System.out 1 String[] argc argc public class Main{
	public static void main(String[] argc){
    	Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String tmp = sc.next();
        long K = Long.parseLong(tmp);

        if(s.length() == 1){
            System.out.println(s);
            return;
        }

        for(int i=0;i<s.length();i++){
            if(s.charAt(i) != '1'){
                if(K < i+1){
                    System.out.println(1);
                    return;
                }else{
                    System.out.println(s.charAt(i));
                    return;
                }
            }
        }

        System.out.println(1);

    }
} public class Main{
	public static void main(String[] argc){
    	Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String tmp = sc.next();
        long K = Long.parseLong(tmp);

        if(s.length() == 1){
            System.out.println(s);
            return;
        }

        for(int i=0;i<s.length();i++){
            if(s.charAt(i) != '1'){
                if(K < i+1){
                    System.out.println(1);
                    return;
                }else{
                    System.out.println(s.charAt(i));
                    return;
                }
            }
        }

        System.out.println(1);

    }
} Main
import java.util.*;

public class Main{
	public static void main(String[] argc){
    	Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String tmp = sc.next();
        long K = Long.parseLong(tmp);

        if(s.length() == 1){
            System.out.println(s);
            return;
        }

        for(int i=0;i<s.length();i++){
            if(s.charAt(i) != '1'){
                if(K < i+1){
                    System.out.println(1);
                    return;
                }else{
                    System.out.println(s.charAt(i));
                    return;
                }
            }
        }

        System.out.println(1);

    }
}