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();

    sc.close(); 

    String[] S = S_.split("");

    long result = 1;
    long i = 0;

    while (i < K) {
      if (!S[(int)i].equals("1")) {
        result = Integer.valueOf(S[(int)i]);
        break;
      }
      i++;
    }

    System.out.println(result);

  }

} 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();

    sc.close(); 

    String[] S = S_.split("");

    long result = 1;
    long i = 0;

    while (i < K) {
      if (!S[(int)i].equals("1")) {
        result = Integer.valueOf(S[(int)i]);
        break;
      }
      i++;
    }

    System.out.println(result);

  }

} Main public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

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

    sc.close(); 

    String[] S = S_.split("");

    long result = 1;
    long i = 0;

    while (i < K) {
      if (!S[(int)i].equals("1")) {
        result = Integer.valueOf(S[(int)i]);
        break;
      }
      i++;
    }

    System.out.println(result);

  } main {

    Scanner sc = new Scanner(System.in);

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

    sc.close(); 

    String[] S = S_.split("");

    long result = 1;
    long i = 0;

    while (i < K) {
      if (!S[(int)i].equals("1")) {
        result = Integer.valueOf(S[(int)i]);
        break;
      }
      i++;
    }

    System.out.println(result);

  } 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 sc.close() sc.close sc String[] S = S_.split(""); S S_.split("") S_.split S_ "" long result = 1; result 1 long i = 0; i 0 while (i < K) {
      if (!S[(int)i].equals("1")) {
        result = Integer.valueOf(S[(int)i]);
        break;
      }
      i++;
    } i < K i K {
      if (!S[(int)i].equals("1")) {
        result = Integer.valueOf(S[(int)i]);
        break;
      }
      i++;
    } if (!S[(int)i].equals("1")) {
        result = Integer.valueOf(S[(int)i]);
        break;
      } !S[(int)i].equals("1") S[(int)i].equals("1") S[(int)i].equals S[(int)i] S (int)i "1" {
        result = Integer.valueOf(S[(int)i]);
        break;
      } result = Integer.valueOf(S[(int)i]) result Integer.valueOf(S[(int)i]) Integer.valueOf Integer S[(int)i] S (int)i break; i++ i System.out.println(result) System.out.println System.out System System.out result 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();

    sc.close(); 

    String[] S = S_.split("");

    long result = 1;
    long i = 0;

    while (i < K) {
      if (!S[(int)i].equals("1")) {
        result = Integer.valueOf(S[(int)i]);
        break;
      }
      i++;
    }

    System.out.println(result);

  }

} public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

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

    sc.close(); 

    String[] S = S_.split("");

    long result = 1;
    long i = 0;

    while (i < K) {
      if (!S[(int)i].equals("1")) {
        result = Integer.valueOf(S[(int)i]);
        break;
      }
      i++;
    }

    System.out.println(result);

  }

} 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();

    sc.close(); 

    String[] S = S_.split("");

    long result = 1;
    long i = 0;

    while (i < K) {
      if (!S[(int)i].equals("1")) {
        result = Integer.valueOf(S[(int)i]);
        break;
      }
      i++;
    }

    System.out.println(result);

  }

}