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 = sc.nextLong();
        String ans = "1";
        long count = 0l;
        for (int i = 0; i < s.length() ; i++) {
            String ss = s.substring(i, i + 1);
            if(s.substring(i, i +1).equals("1")) {
                count++;
            }
            else if(!ss.equals("1")) {
                ans = ss;
                break;
            }
        }
        if(count >= k) System.out.println("1");
        else System.out.println(ans);
    }
} 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 = sc.nextLong();
        String ans = "1";
        long count = 0l;
        for (int i = 0; i < s.length() ; i++) {
            String ss = s.substring(i, i + 1);
            if(s.substring(i, i +1).equals("1")) {
                count++;
            }
            else if(!ss.equals("1")) {
                ans = ss;
                break;
            }
        }
        if(count >= k) System.out.println("1");
        else System.out.println(ans);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        long k = sc.nextLong();
        String ans = "1";
        long count = 0l;
        for (int i = 0; i < s.length() ; i++) {
            String ss = s.substring(i, i + 1);
            if(s.substring(i, i +1).equals("1")) {
                count++;
            }
            else if(!ss.equals("1")) {
                ans = ss;
                break;
            }
        }
        if(count >= k) System.out.println("1");
        else System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        long k = sc.nextLong();
        String ans = "1";
        long count = 0l;
        for (int i = 0; i < s.length() ; i++) {
            String ss = s.substring(i, i + 1);
            if(s.substring(i, i +1).equals("1")) {
                count++;
            }
            else if(!ss.equals("1")) {
                ans = ss;
                break;
            }
        }
        if(count >= k) System.out.println("1");
        else System.out.println(ans);
    } 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 String ans = "1"; ans "1" long count = 0l; count 0l for (int i = 0; i < s.length() ; i++) {
            String ss = s.substring(i, i + 1);
            if(s.substring(i, i +1).equals("1")) {
                count++;
            }
            else if(!ss.equals("1")) {
                ans = ss;
                break;
            }
        } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
            String ss = s.substring(i, i + 1);
            if(s.substring(i, i +1).equals("1")) {
                count++;
            }
            else if(!ss.equals("1")) {
                ans = ss;
                break;
            }
        } {
            String ss = s.substring(i, i + 1);
            if(s.substring(i, i +1).equals("1")) {
                count++;
            }
            else if(!ss.equals("1")) {
                ans = ss;
                break;
            }
        } String ss = s.substring(i, i + 1); ss s.substring(i, i + 1) s.substring s i i + 1 i 1 if(s.substring(i, i +1).equals("1")) {
                count++;
            }
            else if(!ss.equals("1")) {
                ans = ss;
                break;
            } s.substring(i, i +1).equals("1") s.substring(i, i +1).equals s.substring(i, i +1) s.substring s i i +1 i 1 "1" {
                count++;
            } count++ count if(!ss.equals("1")) {
                ans = ss;
                break;
            } !ss.equals("1") ss.equals("1") ss.equals ss "1" {
                ans = ss;
                break;
            } ans = ss ans ss break; if(count >= k) System.out.println("1");
        else System.out.println(ans); count >= k count k System.out.println("1") System.out.println System.out System System.out "1" System.out.println(ans) System.out.println System.out System System.out ans 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();
        String ans = "1";
        long count = 0l;
        for (int i = 0; i < s.length() ; i++) {
            String ss = s.substring(i, i + 1);
            if(s.substring(i, i +1).equals("1")) {
                count++;
            }
            else if(!ss.equals("1")) {
                ans = ss;
                break;
            }
        }
        if(count >= k) System.out.println("1");
        else System.out.println(ans);
    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        long k = sc.nextLong();
        String ans = "1";
        long count = 0l;
        for (int i = 0; i < s.length() ; i++) {
            String ss = s.substring(i, i + 1);
            if(s.substring(i, i +1).equals("1")) {
                count++;
            }
            else if(!ss.equals("1")) {
                ans = ss;
                break;
            }
        }
        if(count >= k) System.out.println("1");
        else System.out.println(ans);
    }
} 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 = sc.nextLong();
        String ans = "1";
        long count = 0l;
        for (int i = 0; i < s.length() ; i++) {
            String ss = s.substring(i, i + 1);
            if(s.substring(i, i +1).equals("1")) {
                count++;
            }
            else if(!ss.equals("1")) {
                ans = ss;
                break;
            }
        }
        if(count >= k) System.out.println("1");
        else System.out.println(ans);
    }
}