import java.util.*;

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

  public static int gcd(int a, int b){
    if(b == 0) return a;
    return gcd(b, a%b);
  }
} import java.util.*; util.* java class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    Long K = sc.nextLong();
    char ans;
    if(K == 1){
      ans = S.charAt(0);
    }else{
      int count = 0;
      for(int i=0; i<S.length(); i++){
        if(S.charAt(i) != '1') break;
        count++;
      }
      if(K <= count) ans = '1';
      else ans = S.charAt(count);
    }
    System.out.println(ans);
  }

  public static int gcd(int a, int b){
    if(b == 0) return a;
    return gcd(b, a%b);
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    Long K = sc.nextLong();
    char ans;
    if(K == 1){
      ans = S.charAt(0);
    }else{
      int count = 0;
      for(int i=0; i<S.length(); i++){
        if(S.charAt(i) != '1') break;
        count++;
      }
      if(K <= count) ans = '1';
      else ans = S.charAt(count);
    }
    System.out.println(ans);
  } main {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    Long K = sc.nextLong();
    char ans;
    if(K == 1){
      ans = S.charAt(0);
    }else{
      int count = 0;
      for(int i=0; i<S.length(); i++){
        if(S.charAt(i) != '1') break;
        count++;
      }
      if(K <= count) ans = '1';
      else ans = S.charAt(count);
    }
    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 char ans; ans if(K == 1){
      ans = S.charAt(0);
    }else{
      int count = 0;
      for(int i=0; i<S.length(); i++){
        if(S.charAt(i) != '1') break;
        count++;
      }
      if(K <= count) ans = '1';
      else ans = S.charAt(count);
    } K == 1 K 1 {
      ans = S.charAt(0);
    } ans = S.charAt(0) ans S.charAt(0) S.charAt S 0 {
      int count = 0;
      for(int i=0; i<S.length(); i++){
        if(S.charAt(i) != '1') break;
        count++;
      }
      if(K <= count) ans = '1';
      else ans = S.charAt(count);
    } int count = 0; count 0 for(int i=0; i<S.length(); i++){
        if(S.charAt(i) != '1') break;
        count++;
      } 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') break;
        count++;
      } {
        if(S.charAt(i) != '1') break;
        count++;
      } if(S.charAt(i) != '1') break; S.charAt(i) != '1' S.charAt(i) S.charAt S i '1' break; count++ count if(K <= count) ans = '1';
      else ans = S.charAt(count); K <= count K count ans = '1' ans '1' ans = S.charAt(count) ans S.charAt(count) S.charAt S count System.out.println(ans) System.out.println System.out System System.out ans String[] args args public static int gcd(int a, int b){
    if(b == 0) return a;
    return gcd(b, a%b);
  } gcd {
    if(b == 0) return a;
    return gcd(b, a%b);
  } if(b == 0) return a; b == 0 b 0 return a; a return gcd(b, a%b); gcd(b, a%b) gcd b a%b a b int a a int b b
import java.util.*;

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

  public static int gcd(int a, int b){
    if(b == 0) return a;
    return gcd(b, a%b);
  }
}