main :: IO ()
main = do
  s <- getLine
  n <- readLn
  putChar $ solve s n

solve :: String -> Int -> Char
solve (c:cs) 0 = c
solve (c:cs) k
  | c == '1' = solve cs (k - 1)
  | otherwise = c
solve _ _ = '1'
