import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String n = sc.next();
        String strk = sc.next();
        
        int k = 9999;
        if(strk.length() < 3) k = Integer.parseInt(strk);
        String[] arr = n.split("");
        
        //1文字の時
        if(arr.length == 1)System.out.println(n);
        else{
            //2文字以上の時
            boolean flag = true;
            int count = 0;
            int leng = arr.length;
            for(int i = 0; i < leng; i++){
                //前から1が何個続くか
                if(flag && arr[i].equals("1")) count++;
                else flag = false;
                
            }
            
            if(count < k)System.out.println(arr[count]);
            else System.out.println(1);
        }
        
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String n = sc.next();
        String strk = sc.next();
        
        int k = 9999;
        if(strk.length() < 3) k = Integer.parseInt(strk);
        String[] arr = n.split("");
        
        //1文字の時
        if(arr.length == 1)System.out.println(n);
        else{
            //2文字以上の時
            boolean flag = true;
            int count = 0;
            int leng = arr.length;
            for(int i = 0; i < leng; i++){
                //前から1が何個続くか
                if(flag && arr[i].equals("1")) count++;
                else flag = false;
                
            }
            
            if(count < k)System.out.println(arr[count]);
            else System.out.println(1);
        }
        
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String n = sc.next();
        String strk = sc.next();
        
        int k = 9999;
        if(strk.length() < 3) k = Integer.parseInt(strk);
        String[] arr = n.split("");
        
        //1文字の時
        if(arr.length == 1)System.out.println(n);
        else{
            //2文字以上の時
            boolean flag = true;
            int count = 0;
            int leng = arr.length;
            for(int i = 0; i < leng; i++){
                //前から1が何個続くか
                if(flag && arr[i].equals("1")) count++;
                else flag = false;
                
            }
            
            if(count < k)System.out.println(arr[count]);
            else System.out.println(1);
        }
        
    } main {
        Scanner sc = new Scanner(System.in);
        String n = sc.next();
        String strk = sc.next();
        
        int k = 9999;
        if(strk.length() < 3) k = Integer.parseInt(strk);
        String[] arr = n.split("");
        
        //1文字の時
        if(arr.length == 1)System.out.println(n);
        else{
            //2文字以上の時
            boolean flag = true;
            int count = 0;
            int leng = arr.length;
            for(int i = 0; i < leng; i++){
                //前から1が何個続くか
                if(flag && arr[i].equals("1")) count++;
                else flag = false;
                
            }
            
            if(count < k)System.out.println(arr[count]);
            else System.out.println(1);
        }
        
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String n = sc.next(); n sc.next() sc.next sc String strk = sc.next(); strk sc.next() sc.next sc int k = 9999; k 9999 if(strk.length() < 3) k = Integer.parseInt(strk); strk.length() < 3 strk.length() strk.length strk 3 k = Integer.parseInt(strk) k Integer.parseInt(strk) Integer.parseInt Integer strk String[] arr = n.split(""); arr n.split("") n.split n "" if(arr.length == 1)System.out.println(n);
        else{
            //2文字以上の時
            boolean flag = true;
            int count = 0;
            int leng = arr.length;
            for(int i = 0; i < leng; i++){
                //前から1が何個続くか
                if(flag && arr[i].equals("1")) count++;
                else flag = false;
                
            }
            
            if(count < k)System.out.println(arr[count]);
            else System.out.println(1);
        } arr.length == 1 arr.length arr arr.length 1 System.out.println(n) System.out.println System.out System System.out n {
            //2文字以上の時
            boolean flag = true;
            int count = 0;
            int leng = arr.length;
            for(int i = 0; i < leng; i++){
                //前から1が何個続くか
                if(flag && arr[i].equals("1")) count++;
                else flag = false;
                
            }
            
            if(count < k)System.out.println(arr[count]);
            else System.out.println(1);
        } boolean flag = true; flag true int count = 0; count 0 int leng = arr.length; leng arr.length arr arr.length for(int i = 0; i < leng; i++){
                //前から1が何個続くか
                if(flag && arr[i].equals("1")) count++;
                else flag = false;
                
            } int i = 0; int i = 0; i 0 i < leng i leng i++ i++ i {
                //前から1が何個続くか
                if(flag && arr[i].equals("1")) count++;
                else flag = false;
                
            } {
                //前から1が何個続くか
                if(flag && arr[i].equals("1")) count++;
                else flag = false;
                
            } if(flag && arr[i].equals("1")) count++;
                else flag = false; flag && arr[i].equals("1") flag arr[i].equals("1") arr[i].equals arr[i] arr i "1" count++ count flag = false flag false if(count < k)System.out.println(arr[count]);
            else System.out.println(1); count < k count k System.out.println(arr[count]) System.out.println System.out System System.out arr[count] arr count System.out.println(1) System.out.println System.out System System.out 1 String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String n = sc.next();
        String strk = sc.next();
        
        int k = 9999;
        if(strk.length() < 3) k = Integer.parseInt(strk);
        String[] arr = n.split("");
        
        //1文字の時
        if(arr.length == 1)System.out.println(n);
        else{
            //2文字以上の時
            boolean flag = true;
            int count = 0;
            int leng = arr.length;
            for(int i = 0; i < leng; i++){
                //前から1が何個続くか
                if(flag && arr[i].equals("1")) count++;
                else flag = false;
                
            }
            
            if(count < k)System.out.println(arr[count]);
            else System.out.println(1);
        }
        
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String n = sc.next();
        String strk = sc.next();
        
        int k = 9999;
        if(strk.length() < 3) k = Integer.parseInt(strk);
        String[] arr = n.split("");
        
        //1文字の時
        if(arr.length == 1)System.out.println(n);
        else{
            //2文字以上の時
            boolean flag = true;
            int count = 0;
            int leng = arr.length;
            for(int i = 0; i < leng; i++){
                //前から1が何個続くか
                if(flag && arr[i].equals("1")) count++;
                else flag = false;
                
            }
            
            if(count < k)System.out.println(arr[count]);
            else System.out.println(1);
        }
        
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String n = sc.next();
        String strk = sc.next();
        
        int k = 9999;
        if(strk.length() < 3) k = Integer.parseInt(strk);
        String[] arr = n.split("");
        
        //1文字の時
        if(arr.length == 1)System.out.println(n);
        else{
            //2文字以上の時
            boolean flag = true;
            int count = 0;
            int leng = arr.length;
            for(int i = 0; i < leng; i++){
                //前から1が何個続くか
                if(flag && arr[i].equals("1")) count++;
                else flag = false;
                
            }
            
            if(count < k)System.out.println(arr[count]);
            else System.out.println(1);
        }
        
    }
}