import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        final long d = 5000000000000000L;
        String S = sc.next();
        long K = sc.nextLong();
        for(int i=0;i<S.length();i++){
            int cur = S.charAt(i)-'0';
            if(cur==1&&i+1<K) continue;
            if(cur==1&&i+1==K){
                System.out.println("1");
                System.exit(0);
            }
            if(cur!=1){
                System.out.println(cur);
                System.exit(0);
            }
        }
        System.out.println("1");
    }
} import java.util.*; util.* java class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        final long d = 5000000000000000L;
        String S = sc.next();
        long K = sc.nextLong();
        for(int i=0;i<S.length();i++){
            int cur = S.charAt(i)-'0';
            if(cur==1&&i+1<K) continue;
            if(cur==1&&i+1==K){
                System.out.println("1");
                System.exit(0);
            }
            if(cur!=1){
                System.out.println(cur);
                System.exit(0);
            }
        }
        System.out.println("1");
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        final long d = 5000000000000000L;
        String S = sc.next();
        long K = sc.nextLong();
        for(int i=0;i<S.length();i++){
            int cur = S.charAt(i)-'0';
            if(cur==1&&i+1<K) continue;
            if(cur==1&&i+1==K){
                System.out.println("1");
                System.exit(0);
            }
            if(cur!=1){
                System.out.println(cur);
                System.exit(0);
            }
        }
        System.out.println("1");
    } main {
        Scanner sc = new Scanner(System.in);
        final long d = 5000000000000000L;
        String S = sc.next();
        long K = sc.nextLong();
        for(int i=0;i<S.length();i++){
            int cur = S.charAt(i)-'0';
            if(cur==1&&i+1<K) continue;
            if(cur==1&&i+1==K){
                System.out.println("1");
                System.exit(0);
            }
            if(cur!=1){
                System.out.println(cur);
                System.exit(0);
            }
        }
        System.out.println("1");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) final long d = 5000000000000000L; d 5000000000000000L String S = sc.next(); S sc.next() sc.next sc long K = sc.nextLong(); K sc.nextLong() sc.nextLong sc for(int i=0;i<S.length();i++){
            int cur = S.charAt(i)-'0';
            if(cur==1&&i+1<K) continue;
            if(cur==1&&i+1==K){
                System.out.println("1");
                System.exit(0);
            }
            if(cur!=1){
                System.out.println(cur);
                System.exit(0);
            }
        } int i=0; int i=0; i 0 i<S.length() i S.length() S.length S i++ i++ i {
            int cur = S.charAt(i)-'0';
            if(cur==1&&i+1<K) continue;
            if(cur==1&&i+1==K){
                System.out.println("1");
                System.exit(0);
            }
            if(cur!=1){
                System.out.println(cur);
                System.exit(0);
            }
        } {
            int cur = S.charAt(i)-'0';
            if(cur==1&&i+1<K) continue;
            if(cur==1&&i+1==K){
                System.out.println("1");
                System.exit(0);
            }
            if(cur!=1){
                System.out.println(cur);
                System.exit(0);
            }
        } int cur = S.charAt(i)-'0'; cur S.charAt(i)-'0' S.charAt(i) S.charAt S i '0' if(cur==1&&i+1<K) continue; cur==1&&i+1<K cur==1 cur 1 i+1<K i+1 i 1 K continue; if(cur==1&&i+1==K){
                System.out.println("1");
                System.exit(0);
            } cur==1&&i+1==K cur==1 cur 1 i+1==K i+1 i 1 K {
                System.out.println("1");
                System.exit(0);
            } System.out.println("1") System.out.println System.out System System.out "1" System.exit(0) System.exit System 0 if(cur!=1){
                System.out.println(cur);
                System.exit(0);
            } cur!=1 cur 1 {
                System.out.println(cur);
                System.exit(0);
            } System.out.println(cur) System.out.println System.out System System.out cur System.exit(0) System.exit System 0 System.out.println("1") System.out.println System.out System System.out "1" String[] args args
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        final long d = 5000000000000000L;
        String S = sc.next();
        long K = sc.nextLong();
        for(int i=0;i<S.length();i++){
            int cur = S.charAt(i)-'0';
            if(cur==1&&i+1<K) continue;
            if(cur==1&&i+1==K){
                System.out.println("1");
                System.exit(0);
            }
            if(cur!=1){
                System.out.println(cur);
                System.exit(0);
            }
        }
        System.out.println("1");
    }
}
