import java.util.*;
import java.io.*;

public class Main {
    public static String S;
    public static int ans(int start,long left){
        if(S.charAt(start)-'0'!=1){
            return S.charAt(start)-'0';
        }
        if (left == 0) {
            return S.charAt(start) - '0';
        }
        return ans(start+1,left-1);
    }
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        S = br.readLine();
        long K = Long.parseLong(br.readLine());
        System.out.println(ans(0,K-1));
    }
} import java.util.*; util.* java import java.io.*; io.* java public class Main {
    public static String S;
    public static int ans(int start,long left){
        if(S.charAt(start)-'0'!=1){
            return S.charAt(start)-'0';
        }
        if (left == 0) {
            return S.charAt(start) - '0';
        }
        return ans(start+1,left-1);
    }
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        S = br.readLine();
        long K = Long.parseLong(br.readLine());
        System.out.println(ans(0,K-1));
    }
} Main public static String S; S public static int ans(int start,long left){
        if(S.charAt(start)-'0'!=1){
            return S.charAt(start)-'0';
        }
        if (left == 0) {
            return S.charAt(start) - '0';
        }
        return ans(start+1,left-1);
    } ans {
        if(S.charAt(start)-'0'!=1){
            return S.charAt(start)-'0';
        }
        if (left == 0) {
            return S.charAt(start) - '0';
        }
        return ans(start+1,left-1);
    } if(S.charAt(start)-'0'!=1){
            return S.charAt(start)-'0';
        } S.charAt(start)-'0'!=1 S.charAt(start)-'0' S.charAt(start) S.charAt S start '0' 1 {
            return S.charAt(start)-'0';
        } return S.charAt(start)-'0'; S.charAt(start)-'0' S.charAt(start) S.charAt S start '0' if (left == 0) {
            return S.charAt(start) - '0';
        } left == 0 left 0 {
            return S.charAt(start) - '0';
        } return S.charAt(start) - '0'; S.charAt(start) - '0' S.charAt(start) S.charAt S start '0' return ans(start+1,left-1); ans(start+1,left-1) ans start+1 start 1 left-1 left 1 int start start long left left public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        S = br.readLine();
        long K = Long.parseLong(br.readLine());
        System.out.println(ans(0,K-1));
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        S = br.readLine();
        long K = Long.parseLong(br.readLine());
        System.out.println(ans(0,K-1));
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) S = br.readLine() S br.readLine() br.readLine br long K = Long.parseLong(br.readLine()); K Long.parseLong(br.readLine()) Long.parseLong Long br.readLine() br.readLine br System.out.println(ans(0,K-1)) System.out.println System.out System System.out ans(0,K-1) ans 0 K-1 K 1 String[] args args public class Main {
    public static String S;
    public static int ans(int start,long left){
        if(S.charAt(start)-'0'!=1){
            return S.charAt(start)-'0';
        }
        if (left == 0) {
            return S.charAt(start) - '0';
        }
        return ans(start+1,left-1);
    }
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        S = br.readLine();
        long K = Long.parseLong(br.readLine());
        System.out.println(ans(0,K-1));
    }
} public class Main {
    public static String S;
    public static int ans(int start,long left){
        if(S.charAt(start)-'0'!=1){
            return S.charAt(start)-'0';
        }
        if (left == 0) {
            return S.charAt(start) - '0';
        }
        return ans(start+1,left-1);
    }
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        S = br.readLine();
        long K = Long.parseLong(br.readLine());
        System.out.println(ans(0,K-1));
    }
} Main
import java.util.*;
import java.io.*;

public class Main {
    public static String S;
    public static int ans(int start,long left){
        if(S.charAt(start)-'0'!=1){
            return S.charAt(start)-'0';
        }
        if (left == 0) {
            return S.charAt(start) - '0';
        }
        return ans(start+1,left-1);
    }
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        S = br.readLine();
        long K = Long.parseLong(br.readLine());
        System.out.println(ans(0,K-1));
    }
}
