local s = io.read();
local k = tonumber(io.read());
local first = string.sub(s,1,1);

if k == 1 or string.len(s) == 1 then
    print(first);
end

local count = 0;
local sub = string.sub(s,1,1);
while sub == "1" do
    count = count + 1;
    s = string.sub(s,2);
    sub = string.sub(s,1,1);
end

if k <= count then
    print(1);
else
    print(string.sub(s,1,1));
end