import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    char[] s = scanner.next().toCharArray();
    long k = scanner.nextLong();

    for (char ch : s) {
      if (ch == '1') {
        k--;
        if (k == 0) {
          System.out.println('1');
          return;
        }
      } else {
        System.out.println(ch);
        return;
      }
    }
  }
} import java.util.Scanner; Scanner java.util public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    char[] s = scanner.next().toCharArray();
    long k = scanner.nextLong();

    for (char ch : s) {
      if (ch == '1') {
        k--;
        if (k == 0) {
          System.out.println('1');
          return;
        }
      } else {
        System.out.println(ch);
        return;
      }
    }
  }
} Main public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    char[] s = scanner.next().toCharArray();
    long k = scanner.nextLong();

    for (char ch : s) {
      if (ch == '1') {
        k--;
        if (k == 0) {
          System.out.println('1');
          return;
        }
      } else {
        System.out.println(ch);
        return;
      }
    }
  } main {
    Scanner scanner = new Scanner(System.in);
    char[] s = scanner.next().toCharArray();
    long k = scanner.nextLong();

    for (char ch : s) {
      if (ch == '1') {
        k--;
        if (k == 0) {
          System.out.println('1');
          return;
        }
      } else {
        System.out.println(ch);
        return;
      }
    }
  } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) char[] s = scanner.next().toCharArray(); s scanner.next().toCharArray() scanner.next().toCharArray scanner.next() scanner.next scanner long k = scanner.nextLong(); k scanner.nextLong() scanner.nextLong scanner for (char ch : s) {
      if (ch == '1') {
        k--;
        if (k == 0) {
          System.out.println('1');
          return;
        }
      } else {
        System.out.println(ch);
        return;
      }
    } char ch s {
      if (ch == '1') {
        k--;
        if (k == 0) {
          System.out.println('1');
          return;
        }
      } else {
        System.out.println(ch);
        return;
      }
    } {
      if (ch == '1') {
        k--;
        if (k == 0) {
          System.out.println('1');
          return;
        }
      } else {
        System.out.println(ch);
        return;
      }
    } if (ch == '1') {
        k--;
        if (k == 0) {
          System.out.println('1');
          return;
        }
      } else {
        System.out.println(ch);
        return;
      } ch == '1' ch '1' {
        k--;
        if (k == 0) {
          System.out.println('1');
          return;
        }
      } k-- k if (k == 0) {
          System.out.println('1');
          return;
        } k == 0 k 0 {
          System.out.println('1');
          return;
        } System.out.println('1') System.out.println System.out System System.out '1' return; {
        System.out.println(ch);
        return;
      } System.out.println(ch) System.out.println System.out System System.out ch return; String[] args args public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    char[] s = scanner.next().toCharArray();
    long k = scanner.nextLong();

    for (char ch : s) {
      if (ch == '1') {
        k--;
        if (k == 0) {
          System.out.println('1');
          return;
        }
      } else {
        System.out.println(ch);
        return;
      }
    }
  }
} public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    char[] s = scanner.next().toCharArray();
    long k = scanner.nextLong();

    for (char ch : s) {
      if (ch == '1') {
        k--;
        if (k == 0) {
          System.out.println('1');
          return;
        }
      } else {
        System.out.println(ch);
        return;
      }
    }
  }
} Main
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    char[] s = scanner.next().toCharArray();
    long k = scanner.nextLong();

    for (char ch : s) {
      if (ch == '1') {
        k--;
        if (k == 0) {
          System.out.println('1');
          return;
        }
      } else {
        System.out.println(ch);
        return;
      }
    }
  }
}
