local s = io.read()
local k = io.read("*n")
ret = "1"
ilast = 101
for i = 1, #s do
  local a = string.sub(s, i, i)
  if(a ~= "1") then
    ilast = i - 1
    ret = a
    break
  end
end
if(k <= ilast) then print("1") else print(ret) end
