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

void main() {
    auto S = readln.chomp.map!(c => c.to!(int) - '0');
    auto K = readln.chomp.to!long;
    long pos = 1;
    foreach(x; S) {
        if (x == 1 && pos < K) {
            pos++;
        } else {
            writeln(x);
            return;
        }
    }
    assert(false);
}

