import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);

        String [] s = sc.next().split("");

        long k = sc.nextLong();

        long sum = 0;

        int ans = 0;

        for (int i = 0; i < s.length; i++) {
            int value = Integer.parseInt(s[i]);
            if (value == 1) {
                sum += 1;
            }
            if (sum >= k || value != 1) {
                ans = value;
                break;
            }
        }

        System.out.println(ans);
    }
} import java.util.*; util.* java public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);

        String [] s = sc.next().split("");

        long k = sc.nextLong();

        long sum = 0;

        int ans = 0;

        for (int i = 0; i < s.length; i++) {
            int value = Integer.parseInt(s[i]);
            if (value == 1) {
                sum += 1;
            }
            if (sum >= k || value != 1) {
                ans = value;
                break;
            }
        }

        System.out.println(ans);
    }
} Main public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);

        String [] s = sc.next().split("");

        long k = sc.nextLong();

        long sum = 0;

        int ans = 0;

        for (int i = 0; i < s.length; i++) {
            int value = Integer.parseInt(s[i]);
            if (value == 1) {
                sum += 1;
            }
            if (sum >= k || value != 1) {
                ans = value;
                break;
            }
        }

        System.out.println(ans);
    } main {
        // write your code here
        Scanner sc = new Scanner(System.in);

        String [] s = sc.next().split("");

        long k = sc.nextLong();

        long sum = 0;

        int ans = 0;

        for (int i = 0; i < s.length; i++) {
            int value = Integer.parseInt(s[i]);
            if (value == 1) {
                sum += 1;
            }
            if (sum >= k || value != 1) {
                ans = value;
                break;
            }
        }

        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String [] s = sc.next().split(""); s sc.next().split("") sc.next().split sc.next() sc.next sc "" long k = sc.nextLong(); k sc.nextLong() sc.nextLong sc long sum = 0; sum 0 int ans = 0; ans 0 for (int i = 0; i < s.length; i++) {
            int value = Integer.parseInt(s[i]);
            if (value == 1) {
                sum += 1;
            }
            if (sum >= k || value != 1) {
                ans = value;
                break;
            }
        } int i = 0; int i = 0; i 0 i < s.length i s.length s s.length i++ i++ i {
            int value = Integer.parseInt(s[i]);
            if (value == 1) {
                sum += 1;
            }
            if (sum >= k || value != 1) {
                ans = value;
                break;
            }
        } {
            int value = Integer.parseInt(s[i]);
            if (value == 1) {
                sum += 1;
            }
            if (sum >= k || value != 1) {
                ans = value;
                break;
            }
        } int value = Integer.parseInt(s[i]); value Integer.parseInt(s[i]) Integer.parseInt Integer s[i] s i if (value == 1) {
                sum += 1;
            } value == 1 value 1 {
                sum += 1;
            } sum += 1 sum 1 if (sum >= k || value != 1) {
                ans = value;
                break;
            } sum >= k || value != 1 sum >= k sum k value != 1 value 1 {
                ans = value;
                break;
            } ans = value ans value break; 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) {
        // write your code here
        Scanner sc = new Scanner(System.in);

        String [] s = sc.next().split("");

        long k = sc.nextLong();

        long sum = 0;

        int ans = 0;

        for (int i = 0; i < s.length; i++) {
            int value = Integer.parseInt(s[i]);
            if (value == 1) {
                sum += 1;
            }
            if (sum >= k || value != 1) {
                ans = value;
                break;
            }
        }

        System.out.println(ans);
    }
} public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);

        String [] s = sc.next().split("");

        long k = sc.nextLong();

        long sum = 0;

        int ans = 0;

        for (int i = 0; i < s.length; i++) {
            int value = Integer.parseInt(s[i]);
            if (value == 1) {
                sum += 1;
            }
            if (sum >= k || value != 1) {
                ans = value;
                break;
            }
        }

        System.out.println(ans);
    }
} Main
import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);

        String [] s = sc.next().split("");

        long k = sc.nextLong();

        long sum = 0;

        int ans = 0;

        for (int i = 0; i < s.length; i++) {
            int value = Integer.parseInt(s[i]);
            if (value == 1) {
                sum += 1;
            }
            if (sum >= k || value != 1) {
                ans = value;
                break;
            }
        }

        System.out.println(ans);
    }
}