import java.util.*;

public class Main {
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);

    String S = sc.next();
    long K = sc.nextLong();

    int one_length = 0;
    String next_string = "1";

    for (int i = 0; i < S.length(); i++) {
      if (S.charAt(i) != '1') {
        one_length = i;
        next_string = String.valueOf(S.charAt(i));
        break;
      }
    }

    String ans = "";

    if (K <= (long)one_length) {
      ans = "1";
    } else {
      ans = next_string;
    }

    System.out.println(ans);
  }
} import java.util.*; util.* java public class Main {
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);

    String S = sc.next();
    long K = sc.nextLong();

    int one_length = 0;
    String next_string = "1";

    for (int i = 0; i < S.length(); i++) {
      if (S.charAt(i) != '1') {
        one_length = i;
        next_string = String.valueOf(S.charAt(i));
        break;
      }
    }

    String ans = "";

    if (K <= (long)one_length) {
      ans = "1";
    } else {
      ans = next_string;
    }

    System.out.println(ans);
  }
} Main public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);

    String S = sc.next();
    long K = sc.nextLong();

    int one_length = 0;
    String next_string = "1";

    for (int i = 0; i < S.length(); i++) {
      if (S.charAt(i) != '1') {
        one_length = i;
        next_string = String.valueOf(S.charAt(i));
        break;
      }
    }

    String ans = "";

    if (K <= (long)one_length) {
      ans = "1";
    } else {
      ans = next_string;
    }

    System.out.println(ans);
  } main {
    Scanner sc = new Scanner(System.in);

    String S = sc.next();
    long K = sc.nextLong();

    int one_length = 0;
    String next_string = "1";

    for (int i = 0; i < S.length(); i++) {
      if (S.charAt(i) != '1') {
        one_length = i;
        next_string = String.valueOf(S.charAt(i));
        break;
      }
    }

    String ans = "";

    if (K <= (long)one_length) {
      ans = "1";
    } else {
      ans = next_string;
    }

    System.out.println(ans);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc long K = sc.nextLong(); K sc.nextLong() sc.nextLong sc int one_length = 0; one_length 0 String next_string = "1"; next_string "1" for (int i = 0; i < S.length(); i++) {
      if (S.charAt(i) != '1') {
        one_length = i;
        next_string = String.valueOf(S.charAt(i));
        break;
      }
    } int i = 0; int i = 0; i 0 i < S.length() i S.length() S.length S i++ i++ i {
      if (S.charAt(i) != '1') {
        one_length = i;
        next_string = String.valueOf(S.charAt(i));
        break;
      }
    } {
      if (S.charAt(i) != '1') {
        one_length = i;
        next_string = String.valueOf(S.charAt(i));
        break;
      }
    } if (S.charAt(i) != '1') {
        one_length = i;
        next_string = String.valueOf(S.charAt(i));
        break;
      } S.charAt(i) != '1' S.charAt(i) S.charAt S i '1' {
        one_length = i;
        next_string = String.valueOf(S.charAt(i));
        break;
      } one_length = i one_length i next_string = String.valueOf(S.charAt(i)) next_string String.valueOf(S.charAt(i)) String.valueOf String S.charAt(i) S.charAt S i break; String ans = ""; ans "" if (K <= (long)one_length) {
      ans = "1";
    } else {
      ans = next_string;
    } K <= (long)one_length K (long)one_length {
      ans = "1";
    } ans = "1" ans "1" {
      ans = next_string;
    } ans = next_string ans next_string System.out.println(ans) System.out.println System.out System System.out ans String args[] args public class Main {
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);

    String S = sc.next();
    long K = sc.nextLong();

    int one_length = 0;
    String next_string = "1";

    for (int i = 0; i < S.length(); i++) {
      if (S.charAt(i) != '1') {
        one_length = i;
        next_string = String.valueOf(S.charAt(i));
        break;
      }
    }

    String ans = "";

    if (K <= (long)one_length) {
      ans = "1";
    } else {
      ans = next_string;
    }

    System.out.println(ans);
  }
} public class Main {
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);

    String S = sc.next();
    long K = sc.nextLong();

    int one_length = 0;
    String next_string = "1";

    for (int i = 0; i < S.length(); i++) {
      if (S.charAt(i) != '1') {
        one_length = i;
        next_string = String.valueOf(S.charAt(i));
        break;
      }
    }

    String ans = "";

    if (K <= (long)one_length) {
      ans = "1";
    } else {
      ans = next_string;
    }

    System.out.println(ans);
  }
} Main
import java.util.*;

public class Main {
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);

    String S = sc.next();
    long K = sc.nextLong();

    int one_length = 0;
    String next_string = "1";

    for (int i = 0; i < S.length(); i++) {
      if (S.charAt(i) != '1') {
        one_length = i;
        next_string = String.valueOf(S.charAt(i));
        break;
      }
    }

    String ans = "";

    if (K <= (long)one_length) {
      ans = "1";
    } else {
      ans = next_string;
    }

    System.out.println(ans);
  }
}
