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();

        System.out.println(solve(S, K));
    }

    public static int solve(String S, long K){
        long next = 5_000_000_000_000_000L;

        long count = 0;
        for (int i=0; i<S.length(); i++) {
            int t = S.charAt(i) - '0';

            count += Math.pow(t, next);

            if (K <= count) return t;
        }

        return -1;
    }
} 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();

        System.out.println(solve(S, K));
    }

    public static int solve(String S, long K){
        long next = 5_000_000_000_000_000L;

        long count = 0;
        for (int i=0; i<S.length(); i++) {
            int t = S.charAt(i) - '0';

            count += Math.pow(t, next);

            if (K <= count) return t;
        }

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

        String S = sc.next();
        long K = sc.nextLong();

        System.out.println(solve(S, K));
    } main {
        Scanner sc = new Scanner(System.in);

        String S = sc.next();
        long K = sc.nextLong();

        System.out.println(solve(S, K));
    } 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 System.out.println(solve(S, K)) System.out.println System.out System System.out solve(S, K) solve S K String[] args args public static int solve(String S, long K){
        long next = 5_000_000_000_000_000L;

        long count = 0;
        for (int i=0; i<S.length(); i++) {
            int t = S.charAt(i) - '0';

            count += Math.pow(t, next);

            if (K <= count) return t;
        }

        return -1;
    } solve {
        long next = 5_000_000_000_000_000L;

        long count = 0;
        for (int i=0; i<S.length(); i++) {
            int t = S.charAt(i) - '0';

            count += Math.pow(t, next);

            if (K <= count) return t;
        }

        return -1;
    } long next = 5_000_000_000_000_000L; next 5_000_000_000_000_000L long count = 0; count 0 for (int i=0; i<S.length(); i++) {
            int t = S.charAt(i) - '0';

            count += Math.pow(t, next);

            if (K <= count) return t;
        } int i=0; int i=0; i 0 i<S.length() i S.length() S.length S i++ i++ i {
            int t = S.charAt(i) - '0';

            count += Math.pow(t, next);

            if (K <= count) return t;
        } {
            int t = S.charAt(i) - '0';

            count += Math.pow(t, next);

            if (K <= count) return t;
        } int t = S.charAt(i) - '0'; t S.charAt(i) - '0' S.charAt(i) S.charAt S i '0' count += Math.pow(t, next) count Math.pow(t, next) Math.pow Math t next if (K <= count) return t; K <= count K count return t; t return -1; -1 1 String S S long K K public class Main {

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

        String S = sc.next();
        long K = sc.nextLong();

        System.out.println(solve(S, K));
    }

    public static int solve(String S, long K){
        long next = 5_000_000_000_000_000L;

        long count = 0;
        for (int i=0; i<S.length(); i++) {
            int t = S.charAt(i) - '0';

            count += Math.pow(t, next);

            if (K <= count) return t;
        }

        return -1;
    }
} public class Main {

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

        String S = sc.next();
        long K = sc.nextLong();

        System.out.println(solve(S, K));
    }

    public static int solve(String S, long K){
        long next = 5_000_000_000_000_000L;

        long count = 0;
        for (int i=0; i<S.length(); i++) {
            int t = S.charAt(i) - '0';

            count += Math.pow(t, next);

            if (K <= count) return t;
        }

        return -1;
    }
} 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();

        System.out.println(solve(S, K));
    }

    public static int solve(String S, long K){
        long next = 5_000_000_000_000_000L;

        long count = 0;
        for (int i=0; i<S.length(); i++) {
            int t = S.charAt(i) - '0';

            count += Math.pow(t, next);

            if (K <= count) return t;
        }

        return -1;
    }
}