
import java.util.*;

public class Main {
    static String S;
    static long K;
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        S=scanner.next();
        K=scanner.nextLong();
        solve();
    }
    public static void solve(){
        int first1Lnegth=0;
        char nextChar=0;
        for(int i=0;i<S.length();i++){
            if(S.charAt(i)=='1'){
                first1Lnegth++;
            }else{
                nextChar=S.charAt(i);
                break;
            }
        }
        if(K<=first1Lnegth){
            put(1);
        }else{
            put(nextChar);
        }
    }

    public static void put(Object object){
        System.out.println(object);
    }
    public static String format(String string,Object... args){
        return String.format(string,args);
    }

    public static class Pair{
        final public int x,y;
        Pair(int x,int y){
            this.x=x;
            this.y=y;
        }
    }
}

/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz