import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String S = scan.next();
        String K = scan.next();
        BigInteger remain = new BigInteger(K);
        char[] data = S.toCharArray();
        if (data.length == 1) {
            System.out.println(data[0]);
            return;
        }
        for (int i = 0; i < data.length; i++) {
            if (data[i] == '1') {
                if (remain.compareTo(BigInteger.ONE) == 0) {
                    System.out.println(data[i]);
                    return;
                }
                remain = remain.subtract(BigInteger.ONE);
            } else {
                System.out.println(data[i]);
                return;
            }
        }
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.math.BigInteger; BigInteger java.math import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String S = scan.next();
        String K = scan.next();
        BigInteger remain = new BigInteger(K);
        char[] data = S.toCharArray();
        if (data.length == 1) {
            System.out.println(data[0]);
            return;
        }
        for (int i = 0; i < data.length; i++) {
            if (data[i] == '1') {
                if (remain.compareTo(BigInteger.ONE) == 0) {
                    System.out.println(data[i]);
                    return;
                }
                remain = remain.subtract(BigInteger.ONE);
            } else {
                System.out.println(data[i]);
                return;
            }
        }
    }
} Main public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    } main {
        Main main = new Main();
        main.solve();
    } Main main = new Main(); main new Main() main.solve() main.solve main String[] args args public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String S = scan.next();
        String K = scan.next();
        BigInteger remain = new BigInteger(K);
        char[] data = S.toCharArray();
        if (data.length == 1) {
            System.out.println(data[0]);
            return;
        }
        for (int i = 0; i < data.length; i++) {
            if (data[i] == '1') {
                if (remain.compareTo(BigInteger.ONE) == 0) {
                    System.out.println(data[i]);
                    return;
                }
                remain = remain.subtract(BigInteger.ONE);
            } else {
                System.out.println(data[i]);
                return;
            }
        }
    } solve {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String S = scan.next();
        String K = scan.next();
        BigInteger remain = new BigInteger(K);
        char[] data = S.toCharArray();
        if (data.length == 1) {
            System.out.println(data[0]);
            return;
        }
        for (int i = 0; i < data.length; i++) {
            if (data[i] == '1') {
                if (remain.compareTo(BigInteger.ONE) == 0) {
                    System.out.println(data[i]);
                    return;
                }
                remain = remain.subtract(BigInteger.ONE);
            } else {
                System.out.println(data[i]);
                return;
            }
        }
    } Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in))); scan new Scanner(new BufferedReader(new InputStreamReader(System.in))) String S = scan.next(); S scan.next() scan.next scan String K = scan.next(); K scan.next() scan.next scan BigInteger remain = new BigInteger(K); remain new BigInteger(K) char[] data = S.toCharArray(); data S.toCharArray() S.toCharArray S if (data.length == 1) {
            System.out.println(data[0]);
            return;
        } data.length == 1 data.length data data.length 1 {
            System.out.println(data[0]);
            return;
        } System.out.println(data[0]) System.out.println System.out System System.out data[0] data 0 return; for (int i = 0; i < data.length; i++) {
            if (data[i] == '1') {
                if (remain.compareTo(BigInteger.ONE) == 0) {
                    System.out.println(data[i]);
                    return;
                }
                remain = remain.subtract(BigInteger.ONE);
            } else {
                System.out.println(data[i]);
                return;
            }
        } int i = 0; int i = 0; i 0 i < data.length i data.length data data.length i++ i++ i {
            if (data[i] == '1') {
                if (remain.compareTo(BigInteger.ONE) == 0) {
                    System.out.println(data[i]);
                    return;
                }
                remain = remain.subtract(BigInteger.ONE);
            } else {
                System.out.println(data[i]);
                return;
            }
        } {
            if (data[i] == '1') {
                if (remain.compareTo(BigInteger.ONE) == 0) {
                    System.out.println(data[i]);
                    return;
                }
                remain = remain.subtract(BigInteger.ONE);
            } else {
                System.out.println(data[i]);
                return;
            }
        } if (data[i] == '1') {
                if (remain.compareTo(BigInteger.ONE) == 0) {
                    System.out.println(data[i]);
                    return;
                }
                remain = remain.subtract(BigInteger.ONE);
            } else {
                System.out.println(data[i]);
                return;
            } data[i] == '1' data[i] data i '1' {
                if (remain.compareTo(BigInteger.ONE) == 0) {
                    System.out.println(data[i]);
                    return;
                }
                remain = remain.subtract(BigInteger.ONE);
            } if (remain.compareTo(BigInteger.ONE) == 0) {
                    System.out.println(data[i]);
                    return;
                } remain.compareTo(BigInteger.ONE) == 0 remain.compareTo(BigInteger.ONE) remain.compareTo remain BigInteger.ONE BigInteger BigInteger.ONE 0 {
                    System.out.println(data[i]);
                    return;
                } System.out.println(data[i]) System.out.println System.out System System.out data[i] data i return; remain = remain.subtract(BigInteger.ONE) remain remain.subtract(BigInteger.ONE) remain.subtract remain BigInteger.ONE BigInteger BigInteger.ONE {
                System.out.println(data[i]);
                return;
            } System.out.println(data[i]) System.out.println System.out System System.out data[i] data i return; public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String S = scan.next();
        String K = scan.next();
        BigInteger remain = new BigInteger(K);
        char[] data = S.toCharArray();
        if (data.length == 1) {
            System.out.println(data[0]);
            return;
        }
        for (int i = 0; i < data.length; i++) {
            if (data[i] == '1') {
                if (remain.compareTo(BigInteger.ONE) == 0) {
                    System.out.println(data[i]);
                    return;
                }
                remain = remain.subtract(BigInteger.ONE);
            } else {
                System.out.println(data[i]);
                return;
            }
        }
    }
} public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String S = scan.next();
        String K = scan.next();
        BigInteger remain = new BigInteger(K);
        char[] data = S.toCharArray();
        if (data.length == 1) {
            System.out.println(data[0]);
            return;
        }
        for (int i = 0; i < data.length; i++) {
            if (data[i] == '1') {
                if (remain.compareTo(BigInteger.ONE) == 0) {
                    System.out.println(data[i]);
                    return;
                }
                remain = remain.subtract(BigInteger.ONE);
            } else {
                System.out.println(data[i]);
                return;
            }
        }
    }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String S = scan.next();
        String K = scan.next();
        BigInteger remain = new BigInteger(K);
        char[] data = S.toCharArray();
        if (data.length == 1) {
            System.out.println(data[0]);
            return;
        }
        for (int i = 0; i < data.length; i++) {
            if (data[i] == '1') {
                if (remain.compareTo(BigInteger.ONE) == 0) {
                    System.out.println(data[i]);
                    return;
                }
                remain = remain.subtract(BigInteger.ONE);
            } else {
                System.out.println(data[i]);
                return;
            }
        }
    }
}
