import Control.Monad

main = do
  s <- getLine
  k <- read <$> getLine
  putStrLn $ solve s k

solve s k =
  if head s == '1' then
    if k == 1 then
      "1"
    else
      solve (tail s) (k-1)
  else
    [head s]
