import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        String s = sc.next();
        long k = Long.parseLong(sc.next());
        
        int a = 0;
        int b = 1;
        for(int i = 0; i < s.length(); i++){
            if(s.charAt(i) != '1'){
                a = i+1;
                b = Integer.parseInt(s.substring(i, i+1));
                break;
            }
        }
        
        if(k < a){
            System.out.println(1);
        }else{
            System.out.println(b);
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        String s = sc.next();
        long k = Long.parseLong(sc.next());
        
        int a = 0;
        int b = 1;
        for(int i = 0; i < s.length(); i++){
            if(s.charAt(i) != '1'){
                a = i+1;
                b = Integer.parseInt(s.substring(i, i+1));
                break;
            }
        }
        
        if(k < a){
            System.out.println(1);
        }else{
            System.out.println(b);
        }
    }
} Main public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        String s = sc.next();
        long k = Long.parseLong(sc.next());
        
        int a = 0;
        int b = 1;
        for(int i = 0; i < s.length(); i++){
            if(s.charAt(i) != '1'){
                a = i+1;
                b = Integer.parseInt(s.substring(i, i+1));
                break;
            }
        }
        
        if(k < a){
            System.out.println(1);
        }else{
            System.out.println(b);
        }
    } main {
        
        Scanner sc = new Scanner(System.in);
        
        String s = sc.next();
        long k = Long.parseLong(sc.next());
        
        int a = 0;
        int b = 1;
        for(int i = 0; i < s.length(); i++){
            if(s.charAt(i) != '1'){
                a = i+1;
                b = Integer.parseInt(s.substring(i, i+1));
                break;
            }
        }
        
        if(k < a){
            System.out.println(1);
        }else{
            System.out.println(b);
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc long k = Long.parseLong(sc.next()); k Long.parseLong(sc.next()) Long.parseLong Long sc.next() sc.next sc int a = 0; a 0 int b = 1; b 1 for(int i = 0; i < s.length(); i++){
            if(s.charAt(i) != '1'){
                a = i+1;
                b = Integer.parseInt(s.substring(i, i+1));
                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'){
                a = i+1;
                b = Integer.parseInt(s.substring(i, i+1));
                break;
            }
        } {
            if(s.charAt(i) != '1'){
                a = i+1;
                b = Integer.parseInt(s.substring(i, i+1));
                break;
            }
        } if(s.charAt(i) != '1'){
                a = i+1;
                b = Integer.parseInt(s.substring(i, i+1));
                break;
            } s.charAt(i) != '1' s.charAt(i) s.charAt s i '1' {
                a = i+1;
                b = Integer.parseInt(s.substring(i, i+1));
                break;
            } a = i+1 a i+1 i 1 b = Integer.parseInt(s.substring(i, i+1)) b Integer.parseInt(s.substring(i, i+1)) Integer.parseInt Integer s.substring(i, i+1) s.substring s i i+1 i 1 break; if(k < a){
            System.out.println(1);
        }else{
            System.out.println(b);
        } k < a k a {
            System.out.println(1);
        } System.out.println(1) System.out.println System.out System System.out 1 {
            System.out.println(b);
        } System.out.println(b) System.out.println System.out System System.out b String[] args args public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        String s = sc.next();
        long k = Long.parseLong(sc.next());
        
        int a = 0;
        int b = 1;
        for(int i = 0; i < s.length(); i++){
            if(s.charAt(i) != '1'){
                a = i+1;
                b = Integer.parseInt(s.substring(i, i+1));
                break;
            }
        }
        
        if(k < a){
            System.out.println(1);
        }else{
            System.out.println(b);
        }
    }
} public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        String s = sc.next();
        long k = Long.parseLong(sc.next());
        
        int a = 0;
        int b = 1;
        for(int i = 0; i < s.length(); i++){
            if(s.charAt(i) != '1'){
                a = i+1;
                b = Integer.parseInt(s.substring(i, i+1));
                break;
            }
        }
        
        if(k < a){
            System.out.println(1);
        }else{
            System.out.println(b);
        }
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        String s = sc.next();
        long k = Long.parseLong(sc.next());
        
        int a = 0;
        int b = 1;
        for(int i = 0; i < s.length(); i++){
            if(s.charAt(i) != '1'){
                a = i+1;
                b = Integer.parseInt(s.substring(i, i+1));
                break;
            }
        }
        
        if(k < a){
            System.out.println(1);
        }else{
            System.out.println(b);
        }
    }
}