import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author hakamada
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC106_3 solver = new ABC106_3();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC106_3 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String S = in.nextLine();
            String K = in.nextLine();
            int hitIndex = 0;
            int ceilK = 0;
            if (K.length() > 3) {
                ceilK = Integer.parseInt(String.valueOf(K.substring(0, 4)));
            } else {
                ceilK = Integer.parseInt(String.valueOf(K));
            }

            for (int i = 0; i < S.length(); i++) {
                if (Integer.parseInt(String.valueOf(S.charAt(i))) >= 2) {
                    hitIndex = i;
                    break;
                }
            }
            if (ceilK < (hitIndex + 1)) {
                out.println(1);
                return;
            }
            //if (hitIndex<ceilK) {
            out.println(String.valueOf(S.charAt(hitIndex)));
            //} else {
//            out.println(String.valueOf(S.charAt(ceilK-1)));
            //}
        }

    }
}
 import java.io.OutputStream; OutputStream java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC106_3 solver = new ABC106_3();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC106_3 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String S = in.nextLine();
            String K = in.nextLine();
            int hitIndex = 0;
            int ceilK = 0;
            if (K.length() > 3) {
                ceilK = Integer.parseInt(String.valueOf(K.substring(0, 4)));
            } else {
                ceilK = Integer.parseInt(String.valueOf(K));
            }

            for (int i = 0; i < S.length(); i++) {
                if (Integer.parseInt(String.valueOf(S.charAt(i))) >= 2) {
                    hitIndex = i;
                    break;
                }
            }
            if (ceilK < (hitIndex + 1)) {
                out.println(1);
                return;
            }
            //if (hitIndex<ceilK) {
            out.println(String.valueOf(S.charAt(hitIndex)));
            //} else {
//            out.println(String.valueOf(S.charAt(ceilK-1)));
            //}
        }

    }
} Main public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC106_3 solver = new ABC106_3();
        solver.solve(1, in, out);
        out.close();
    } main {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC106_3 solver = new ABC106_3();
        solver.solve(1, in, out);
        out.close();
    } InputStream inputStream = System.in; inputStream System.in System System.in OutputStream outputStream = System.out; outputStream System.out System System.out Scanner in = new Scanner(inputStream); in new Scanner(inputStream) PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) ABC106_3 solver = new ABC106_3(); solver new ABC106_3() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class ABC106_3 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String S = in.nextLine();
            String K = in.nextLine();
            int hitIndex = 0;
            int ceilK = 0;
            if (K.length() > 3) {
                ceilK = Integer.parseInt(String.valueOf(K.substring(0, 4)));
            } else {
                ceilK = Integer.parseInt(String.valueOf(K));
            }

            for (int i = 0; i < S.length(); i++) {
                if (Integer.parseInt(String.valueOf(S.charAt(i))) >= 2) {
                    hitIndex = i;
                    break;
                }
            }
            if (ceilK < (hitIndex + 1)) {
                out.println(1);
                return;
            }
            //if (hitIndex<ceilK) {
            out.println(String.valueOf(S.charAt(hitIndex)));
            //} else {
//            out.println(String.valueOf(S.charAt(ceilK-1)));
            //}
        }

    } ABC106_3 public void solve(int testNumber, Scanner in, PrintWriter out) {
            String S = in.nextLine();
            String K = in.nextLine();
            int hitIndex = 0;
            int ceilK = 0;
            if (K.length() > 3) {
                ceilK = Integer.parseInt(String.valueOf(K.substring(0, 4)));
            } else {
                ceilK = Integer.parseInt(String.valueOf(K));
            }

            for (int i = 0; i < S.length(); i++) {
                if (Integer.parseInt(String.valueOf(S.charAt(i))) >= 2) {
                    hitIndex = i;
                    break;
                }
            }
            if (ceilK < (hitIndex + 1)) {
                out.println(1);
                return;
            }
            //if (hitIndex<ceilK) {
            out.println(String.valueOf(S.charAt(hitIndex)));
            //} else {
//            out.println(String.valueOf(S.charAt(ceilK-1)));
            //}
        } solve {
            String S = in.nextLine();
            String K = in.nextLine();
            int hitIndex = 0;
            int ceilK = 0;
            if (K.length() > 3) {
                ceilK = Integer.parseInt(String.valueOf(K.substring(0, 4)));
            } else {
                ceilK = Integer.parseInt(String.valueOf(K));
            }

            for (int i = 0; i < S.length(); i++) {
                if (Integer.parseInt(String.valueOf(S.charAt(i))) >= 2) {
                    hitIndex = i;
                    break;
                }
            }
            if (ceilK < (hitIndex + 1)) {
                out.println(1);
                return;
            }
            //if (hitIndex<ceilK) {
            out.println(String.valueOf(S.charAt(hitIndex)));
            //} else {
//            out.println(String.valueOf(S.charAt(ceilK-1)));
            //}
        } String S = in.nextLine(); S in.nextLine() in.nextLine in String K = in.nextLine(); K in.nextLine() in.nextLine in int hitIndex = 0; hitIndex 0 int ceilK = 0; ceilK 0 if (K.length() > 3) {
                ceilK = Integer.parseInt(String.valueOf(K.substring(0, 4)));
            } else {
                ceilK = Integer.parseInt(String.valueOf(K));
            } K.length() > 3 K.length() K.length K 3 {
                ceilK = Integer.parseInt(String.valueOf(K.substring(0, 4)));
            } ceilK = Integer.parseInt(String.valueOf(K.substring(0, 4))) ceilK Integer.parseInt(String.valueOf(K.substring(0, 4))) Integer.parseInt Integer String.valueOf(K.substring(0, 4)) String.valueOf String K.substring(0, 4) K.substring K 0 4 {
                ceilK = Integer.parseInt(String.valueOf(K));
            } ceilK = Integer.parseInt(String.valueOf(K)) ceilK Integer.parseInt(String.valueOf(K)) Integer.parseInt Integer String.valueOf(K) String.valueOf String K for (int i = 0; i < S.length(); i++) {
                if (Integer.parseInt(String.valueOf(S.charAt(i))) >= 2) {
                    hitIndex = i;
                    break;
                }
            } int i = 0; int i = 0; i 0 i < S.length() i S.length() S.length S i++ i++ i {
                if (Integer.parseInt(String.valueOf(S.charAt(i))) >= 2) {
                    hitIndex = i;
                    break;
                }
            } {
                if (Integer.parseInt(String.valueOf(S.charAt(i))) >= 2) {
                    hitIndex = i;
                    break;
                }
            } if (Integer.parseInt(String.valueOf(S.charAt(i))) >= 2) {
                    hitIndex = i;
                    break;
                } Integer.parseInt(String.valueOf(S.charAt(i))) >= 2 Integer.parseInt(String.valueOf(S.charAt(i))) Integer.parseInt Integer String.valueOf(S.charAt(i)) String.valueOf String S.charAt(i) S.charAt S i 2 {
                    hitIndex = i;
                    break;
                } hitIndex = i hitIndex i break; if (ceilK < (hitIndex + 1)) {
                out.println(1);
                return;
            } ceilK < (hitIndex + 1) ceilK (hitIndex + 1) hitIndex 1 {
                out.println(1);
                return;
            } out.println(1) out.println out 1 return; out.println(String.valueOf(S.charAt(hitIndex))) out.println out String.valueOf(S.charAt(hitIndex)) String.valueOf String S.charAt(hitIndex) S.charAt S hitIndex int testNumber testNumber Scanner in in PrintWriter out out public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC106_3 solver = new ABC106_3();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC106_3 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String S = in.nextLine();
            String K = in.nextLine();
            int hitIndex = 0;
            int ceilK = 0;
            if (K.length() > 3) {
                ceilK = Integer.parseInt(String.valueOf(K.substring(0, 4)));
            } else {
                ceilK = Integer.parseInt(String.valueOf(K));
            }

            for (int i = 0; i < S.length(); i++) {
                if (Integer.parseInt(String.valueOf(S.charAt(i))) >= 2) {
                    hitIndex = i;
                    break;
                }
            }
            if (ceilK < (hitIndex + 1)) {
                out.println(1);
                return;
            }
            //if (hitIndex<ceilK) {
            out.println(String.valueOf(S.charAt(hitIndex)));
            //} else {
//            out.println(String.valueOf(S.charAt(ceilK-1)));
            //}
        }

    }
} public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC106_3 solver = new ABC106_3();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC106_3 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String S = in.nextLine();
            String K = in.nextLine();
            int hitIndex = 0;
            int ceilK = 0;
            if (K.length() > 3) {
                ceilK = Integer.parseInt(String.valueOf(K.substring(0, 4)));
            } else {
                ceilK = Integer.parseInt(String.valueOf(K));
            }

            for (int i = 0; i < S.length(); i++) {
                if (Integer.parseInt(String.valueOf(S.charAt(i))) >= 2) {
                    hitIndex = i;
                    break;
                }
            }
            if (ceilK < (hitIndex + 1)) {
                out.println(1);
                return;
            }
            //if (hitIndex<ceilK) {
            out.println(String.valueOf(S.charAt(hitIndex)));
            //} else {
//            out.println(String.valueOf(S.charAt(ceilK-1)));
            //}
        }

    }
} Main
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author hakamada
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC106_3 solver = new ABC106_3();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC106_3 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String S = in.nextLine();
            String K = in.nextLine();
            int hitIndex = 0;
            int ceilK = 0;
            if (K.length() > 3) {
                ceilK = Integer.parseInt(String.valueOf(K.substring(0, 4)));
            } else {
                ceilK = Integer.parseInt(String.valueOf(K));
            }

            for (int i = 0; i < S.length(); i++) {
                if (Integer.parseInt(String.valueOf(S.charAt(i))) >= 2) {
                    hitIndex = i;
                    break;
                }
            }
            if (ceilK < (hitIndex + 1)) {
                out.println(1);
                return;
            }
            //if (hitIndex<ceilK) {
            out.println(String.valueOf(S.charAt(hitIndex)));
            //} else {
//            out.println(String.valueOf(S.charAt(ceilK-1)));
            //}
        }

    }
}

