import java.util.*;

public class Main {
    static long GOSENCHOU = 5000000000000000l;
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        int n = str.length();
        int[] s = new int[n];
        long k = sc.nextLong();
        int answer = -1;
        for (int i = 0; i < n; i++) {
            s[i] = Integer.parseInt(String.valueOf(str.charAt(i)));
            if (s[i] == 1) {
                if (i + 1 == k) {
                    answer = 1;
                    break;
                }
            } else {
                answer = s[i];
                break;
            }
        }
        
        System.out.println(answer);
    }
} import java.util.*; util.* java public class Main {
    static long GOSENCHOU = 5000000000000000l;
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        int n = str.length();
        int[] s = new int[n];
        long k = sc.nextLong();
        int answer = -1;
        for (int i = 0; i < n; i++) {
            s[i] = Integer.parseInt(String.valueOf(str.charAt(i)));
            if (s[i] == 1) {
                if (i + 1 == k) {
                    answer = 1;
                    break;
                }
            } else {
                answer = s[i];
                break;
            }
        }
        
        System.out.println(answer);
    }
} Main static long GOSENCHOU = 5000000000000000l; GOSENCHOU 5000000000000000l public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        int n = str.length();
        int[] s = new int[n];
        long k = sc.nextLong();
        int answer = -1;
        for (int i = 0; i < n; i++) {
            s[i] = Integer.parseInt(String.valueOf(str.charAt(i)));
            if (s[i] == 1) {
                if (i + 1 == k) {
                    answer = 1;
                    break;
                }
            } else {
                answer = s[i];
                break;
            }
        }
        
        System.out.println(answer);
    } main {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        int n = str.length();
        int[] s = new int[n];
        long k = sc.nextLong();
        int answer = -1;
        for (int i = 0; i < n; i++) {
            s[i] = Integer.parseInt(String.valueOf(str.charAt(i)));
            if (s[i] == 1) {
                if (i + 1 == k) {
                    answer = 1;
                    break;
                }
            } else {
                answer = s[i];
                break;
            }
        }
        
        System.out.println(answer);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str = sc.next(); str sc.next() sc.next sc int n = str.length(); n str.length() str.length str int[] s = new int[n]; s new int[n] n long k = sc.nextLong(); k sc.nextLong() sc.nextLong sc int answer = -1; answer -1 1 for (int i = 0; i < n; i++) {
            s[i] = Integer.parseInt(String.valueOf(str.charAt(i)));
            if (s[i] == 1) {
                if (i + 1 == k) {
                    answer = 1;
                    break;
                }
            } else {
                answer = s[i];
                break;
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            s[i] = Integer.parseInt(String.valueOf(str.charAt(i)));
            if (s[i] == 1) {
                if (i + 1 == k) {
                    answer = 1;
                    break;
                }
            } else {
                answer = s[i];
                break;
            }
        } {
            s[i] = Integer.parseInt(String.valueOf(str.charAt(i)));
            if (s[i] == 1) {
                if (i + 1 == k) {
                    answer = 1;
                    break;
                }
            } else {
                answer = s[i];
                break;
            }
        } s[i] = Integer.parseInt(String.valueOf(str.charAt(i))) s[i] s i Integer.parseInt(String.valueOf(str.charAt(i))) Integer.parseInt Integer String.valueOf(str.charAt(i)) String.valueOf String str.charAt(i) str.charAt str i if (s[i] == 1) {
                if (i + 1 == k) {
                    answer = 1;
                    break;
                }
            } else {
                answer = s[i];
                break;
            } s[i] == 1 s[i] s i 1 {
                if (i + 1 == k) {
                    answer = 1;
                    break;
                }
            } if (i + 1 == k) {
                    answer = 1;
                    break;
                } i + 1 == k i + 1 i 1 k {
                    answer = 1;
                    break;
                } answer = 1 answer 1 break; {
                answer = s[i];
                break;
            } answer = s[i] answer s[i] s i break; System.out.println(answer) System.out.println System.out System System.out answer String[] args args public class Main {
    static long GOSENCHOU = 5000000000000000l;
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        int n = str.length();
        int[] s = new int[n];
        long k = sc.nextLong();
        int answer = -1;
        for (int i = 0; i < n; i++) {
            s[i] = Integer.parseInt(String.valueOf(str.charAt(i)));
            if (s[i] == 1) {
                if (i + 1 == k) {
                    answer = 1;
                    break;
                }
            } else {
                answer = s[i];
                break;
            }
        }
        
        System.out.println(answer);
    }
} public class Main {
    static long GOSENCHOU = 5000000000000000l;
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        int n = str.length();
        int[] s = new int[n];
        long k = sc.nextLong();
        int answer = -1;
        for (int i = 0; i < n; i++) {
            s[i] = Integer.parseInt(String.valueOf(str.charAt(i)));
            if (s[i] == 1) {
                if (i + 1 == k) {
                    answer = 1;
                    break;
                }
            } else {
                answer = s[i];
                break;
            }
        }
        
        System.out.println(answer);
    }
} Main
import java.util.*;

public class Main {
    static long GOSENCHOU = 5000000000000000l;
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        int n = str.length();
        int[] s = new int[n];
        long k = sc.nextLong();
        int answer = -1;
        for (int i = 0; i < n; i++) {
            s[i] = Integer.parseInt(String.valueOf(str.charAt(i)));
            if (s[i] == 1) {
                if (i + 1 == k) {
                    answer = 1;
                    break;
                }
            } else {
                answer = s[i];
                break;
            }
        }
        
        System.out.println(answer);
    }
}