import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

char calc(string s, long k) {
    int p = -1;
    for (int i = 0; i < s.length; i++) {
        if (s[i] == '1') p = i;
        else break;
    }

    if (k <= p + 1) return '1';
    return s[p+1];
}

void main() {
    string s = read!string;
    long k = read!long;
    writeln(calc(s, k));
}
