import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String k = sc.next();
    int ans = 1;
    long nk = Long.parseLong(k);
    if(nk == 1) {
      ans = Integer.parseInt(String.valueOf(s.charAt(0)));
    } else {
      int len = s.length();
      if(nk <= len) {
        int n1 = (int)nk;
        for(int j = n1 - 1; j >= 0; j--) {
          int t = Integer.parseInt(String.valueOf(s.charAt(j)));
          if(t != 1) ans = t;
        }
      } else {
        for(int j = len - 1; j >= 0; j--) {
          int t = Integer.parseInt(String.valueOf(s.charAt(j)));
          if(t != 1) ans = t;
        }
      }
    }
    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();
    String k = sc.next();
    int ans = 1;
    long nk = Long.parseLong(k);
    if(nk == 1) {
      ans = Integer.parseInt(String.valueOf(s.charAt(0)));
    } else {
      int len = s.length();
      if(nk <= len) {
        int n1 = (int)nk;
        for(int j = n1 - 1; j >= 0; j--) {
          int t = Integer.parseInt(String.valueOf(s.charAt(j)));
          if(t != 1) ans = t;
        }
      } else {
        for(int j = len - 1; j >= 0; j--) {
          int t = Integer.parseInt(String.valueOf(s.charAt(j)));
          if(t != 1) ans = t;
        }
      }
    }
    System.out.println(ans);
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String k = sc.next();
    int ans = 1;
    long nk = Long.parseLong(k);
    if(nk == 1) {
      ans = Integer.parseInt(String.valueOf(s.charAt(0)));
    } else {
      int len = s.length();
      if(nk <= len) {
        int n1 = (int)nk;
        for(int j = n1 - 1; j >= 0; j--) {
          int t = Integer.parseInt(String.valueOf(s.charAt(j)));
          if(t != 1) ans = t;
        }
      } else {
        for(int j = len - 1; j >= 0; j--) {
          int t = Integer.parseInt(String.valueOf(s.charAt(j)));
          if(t != 1) ans = t;
        }
      }
    }
    System.out.println(ans);
  } main {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String k = sc.next();
    int ans = 1;
    long nk = Long.parseLong(k);
    if(nk == 1) {
      ans = Integer.parseInt(String.valueOf(s.charAt(0)));
    } else {
      int len = s.length();
      if(nk <= len) {
        int n1 = (int)nk;
        for(int j = n1 - 1; j >= 0; j--) {
          int t = Integer.parseInt(String.valueOf(s.charAt(j)));
          if(t != 1) ans = t;
        }
      } else {
        for(int j = len - 1; j >= 0; j--) {
          int t = Integer.parseInt(String.valueOf(s.charAt(j)));
          if(t != 1) ans = t;
        }
      }
    }
    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 String k = sc.next(); k sc.next() sc.next sc int ans = 1; ans 1 long nk = Long.parseLong(k); nk Long.parseLong(k) Long.parseLong Long k if(nk == 1) {
      ans = Integer.parseInt(String.valueOf(s.charAt(0)));
    } else {
      int len = s.length();
      if(nk <= len) {
        int n1 = (int)nk;
        for(int j = n1 - 1; j >= 0; j--) {
          int t = Integer.parseInt(String.valueOf(s.charAt(j)));
          if(t != 1) ans = t;
        }
      } else {
        for(int j = len - 1; j >= 0; j--) {
          int t = Integer.parseInt(String.valueOf(s.charAt(j)));
          if(t != 1) ans = t;
        }
      }
    } nk == 1 nk 1 {
      ans = Integer.parseInt(String.valueOf(s.charAt(0)));
    } ans = Integer.parseInt(String.valueOf(s.charAt(0))) ans Integer.parseInt(String.valueOf(s.charAt(0))) Integer.parseInt Integer String.valueOf(s.charAt(0)) String.valueOf String s.charAt(0) s.charAt s 0 {
      int len = s.length();
      if(nk <= len) {
        int n1 = (int)nk;
        for(int j = n1 - 1; j >= 0; j--) {
          int t = Integer.parseInt(String.valueOf(s.charAt(j)));
          if(t != 1) ans = t;
        }
      } else {
        for(int j = len - 1; j >= 0; j--) {
          int t = Integer.parseInt(String.valueOf(s.charAt(j)));
          if(t != 1) ans = t;
        }
      }
    } int len = s.length(); len s.length() s.length s if(nk <= len) {
        int n1 = (int)nk;
        for(int j = n1 - 1; j >= 0; j--) {
          int t = Integer.parseInt(String.valueOf(s.charAt(j)));
          if(t != 1) ans = t;
        }
      } else {
        for(int j = len - 1; j >= 0; j--) {
          int t = Integer.parseInt(String.valueOf(s.charAt(j)));
          if(t != 1) ans = t;
        }
      } nk <= len nk len {
        int n1 = (int)nk;
        for(int j = n1 - 1; j >= 0; j--) {
          int t = Integer.parseInt(String.valueOf(s.charAt(j)));
          if(t != 1) ans = t;
        }
      } int n1 = (int)nk; n1 (int)nk for(int j = n1 - 1; j >= 0; j--) {
          int t = Integer.parseInt(String.valueOf(s.charAt(j)));
          if(t != 1) ans = t;
        } int j = n1 - 1; int j = n1 - 1; j n1 - 1 n1 1 j >= 0 j 0 j-- j-- j {
          int t = Integer.parseInt(String.valueOf(s.charAt(j)));
          if(t != 1) ans = t;
        } {
          int t = Integer.parseInt(String.valueOf(s.charAt(j)));
          if(t != 1) ans = t;
        } int t = Integer.parseInt(String.valueOf(s.charAt(j))); t Integer.parseInt(String.valueOf(s.charAt(j))) Integer.parseInt Integer String.valueOf(s.charAt(j)) String.valueOf String s.charAt(j) s.charAt s j if(t != 1) ans = t; t != 1 t 1 ans = t ans t {
        for(int j = len - 1; j >= 0; j--) {
          int t = Integer.parseInt(String.valueOf(s.charAt(j)));
          if(t != 1) ans = t;
        }
      } for(int j = len - 1; j >= 0; j--) {
          int t = Integer.parseInt(String.valueOf(s.charAt(j)));
          if(t != 1) ans = t;
        } int j = len - 1; int j = len - 1; j len - 1 len 1 j >= 0 j 0 j-- j-- j {
          int t = Integer.parseInt(String.valueOf(s.charAt(j)));
          if(t != 1) ans = t;
        } {
          int t = Integer.parseInt(String.valueOf(s.charAt(j)));
          if(t != 1) ans = t;
        } int t = Integer.parseInt(String.valueOf(s.charAt(j))); t Integer.parseInt(String.valueOf(s.charAt(j))) Integer.parseInt Integer String.valueOf(s.charAt(j)) String.valueOf String s.charAt(j) s.charAt s j if(t != 1) ans = t; t != 1 t 1 ans = t ans t 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();
    String k = sc.next();
    int ans = 1;
    long nk = Long.parseLong(k);
    if(nk == 1) {
      ans = Integer.parseInt(String.valueOf(s.charAt(0)));
    } else {
      int len = s.length();
      if(nk <= len) {
        int n1 = (int)nk;
        for(int j = n1 - 1; j >= 0; j--) {
          int t = Integer.parseInt(String.valueOf(s.charAt(j)));
          if(t != 1) ans = t;
        }
      } else {
        for(int j = len - 1; j >= 0; j--) {
          int t = Integer.parseInt(String.valueOf(s.charAt(j)));
          if(t != 1) ans = t;
        }
      }
    }
    System.out.println(ans);
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String k = sc.next();
    int ans = 1;
    long nk = Long.parseLong(k);
    if(nk == 1) {
      ans = Integer.parseInt(String.valueOf(s.charAt(0)));
    } else {
      int len = s.length();
      if(nk <= len) {
        int n1 = (int)nk;
        for(int j = n1 - 1; j >= 0; j--) {
          int t = Integer.parseInt(String.valueOf(s.charAt(j)));
          if(t != 1) ans = t;
        }
      } else {
        for(int j = len - 1; j >= 0; j--) {
          int t = Integer.parseInt(String.valueOf(s.charAt(j)));
          if(t != 1) ans = t;
        }
      }
    }
    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();
    String k = sc.next();
    int ans = 1;
    long nk = Long.parseLong(k);
    if(nk == 1) {
      ans = Integer.parseInt(String.valueOf(s.charAt(0)));
    } else {
      int len = s.length();
      if(nk <= len) {
        int n1 = (int)nk;
        for(int j = n1 - 1; j >= 0; j--) {
          int t = Integer.parseInt(String.valueOf(s.charAt(j)));
          if(t != 1) ans = t;
        }
      } else {
        for(int j = len - 1; j >= 0; j--) {
          int t = Integer.parseInt(String.valueOf(s.charAt(j)));
          if(t != 1) ans = t;
        }
      }
    }
    System.out.println(ans);
  }
}