import java.util.Scanner;

public class Main {

    private static Scanner sc = new Scanner(System.in);

    public static void main(String args[]) {

        String s = sc.nextLine();
        long k = sc.nextLong();

        int numOfOnes = 0;
        int ans = 1;

        for (char ch : s.toCharArray()) {
            if (ch != '1') {
                ans = Integer.valueOf(String.valueOf(ch));
                break;
            } else {
                numOfOnes++;
            }
        }

        System.out.println(k <= numOfOnes ? "1" : ans);

    }

} import java.util.Scanner; Scanner java.util public class Main {

    private static Scanner sc = new Scanner(System.in);

    public static void main(String args[]) {

        String s = sc.nextLine();
        long k = sc.nextLong();

        int numOfOnes = 0;
        int ans = 1;

        for (char ch : s.toCharArray()) {
            if (ch != '1') {
                ans = Integer.valueOf(String.valueOf(ch));
                break;
            } else {
                numOfOnes++;
            }
        }

        System.out.println(k <= numOfOnes ? "1" : ans);

    }

} Main private static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String args[]) {

        String s = sc.nextLine();
        long k = sc.nextLong();

        int numOfOnes = 0;
        int ans = 1;

        for (char ch : s.toCharArray()) {
            if (ch != '1') {
                ans = Integer.valueOf(String.valueOf(ch));
                break;
            } else {
                numOfOnes++;
            }
        }

        System.out.println(k <= numOfOnes ? "1" : ans);

    } main {

        String s = sc.nextLine();
        long k = sc.nextLong();

        int numOfOnes = 0;
        int ans = 1;

        for (char ch : s.toCharArray()) {
            if (ch != '1') {
                ans = Integer.valueOf(String.valueOf(ch));
                break;
            } else {
                numOfOnes++;
            }
        }

        System.out.println(k <= numOfOnes ? "1" : ans);

    } String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc long k = sc.nextLong(); k sc.nextLong() sc.nextLong sc int numOfOnes = 0; numOfOnes 0 int ans = 1; ans 1 for (char ch : s.toCharArray()) {
            if (ch != '1') {
                ans = Integer.valueOf(String.valueOf(ch));
                break;
            } else {
                numOfOnes++;
            }
        } char ch s.toCharArray() s.toCharArray s {
            if (ch != '1') {
                ans = Integer.valueOf(String.valueOf(ch));
                break;
            } else {
                numOfOnes++;
            }
        } {
            if (ch != '1') {
                ans = Integer.valueOf(String.valueOf(ch));
                break;
            } else {
                numOfOnes++;
            }
        } if (ch != '1') {
                ans = Integer.valueOf(String.valueOf(ch));
                break;
            } else {
                numOfOnes++;
            } ch != '1' ch '1' {
                ans = Integer.valueOf(String.valueOf(ch));
                break;
            } ans = Integer.valueOf(String.valueOf(ch)) ans Integer.valueOf(String.valueOf(ch)) Integer.valueOf Integer String.valueOf(ch) String.valueOf String ch break; {
                numOfOnes++;
            } numOfOnes++ numOfOnes System.out.println(k <= numOfOnes ? "1" : ans) System.out.println System.out System System.out k <= numOfOnes ? "1" : ans k <= numOfOnes k numOfOnes "1" ans String args[] args public class Main {

    private static Scanner sc = new Scanner(System.in);

    public static void main(String args[]) {

        String s = sc.nextLine();
        long k = sc.nextLong();

        int numOfOnes = 0;
        int ans = 1;

        for (char ch : s.toCharArray()) {
            if (ch != '1') {
                ans = Integer.valueOf(String.valueOf(ch));
                break;
            } else {
                numOfOnes++;
            }
        }

        System.out.println(k <= numOfOnes ? "1" : ans);

    }

} public class Main {

    private static Scanner sc = new Scanner(System.in);

    public static void main(String args[]) {

        String s = sc.nextLine();
        long k = sc.nextLong();

        int numOfOnes = 0;
        int ans = 1;

        for (char ch : s.toCharArray()) {
            if (ch != '1') {
                ans = Integer.valueOf(String.valueOf(ch));
                break;
            } else {
                numOfOnes++;
            }
        }

        System.out.println(k <= numOfOnes ? "1" : ans);

    }

} Main
import java.util.Scanner;

public class Main {

    private static Scanner sc = new Scanner(System.in);

    public static void main(String args[]) {

        String s = sc.nextLine();
        long k = sc.nextLong();

        int numOfOnes = 0;
        int ans = 1;

        for (char ch : s.toCharArray()) {
            if (ch != '1') {
                ans = Integer.valueOf(String.valueOf(ch));
                break;
            } else {
                numOfOnes++;
            }
        }

        System.out.println(k <= numOfOnes ? "1" : ans);

    }

}
