main :: IO ()
main = do
  s <- getString
  k <- getInt
  putStrLn . f . filter (/= '1') . take k $ s
  where
    f    [] = "1"
    f (x:_) = [x]

getInt :: IO Int
getInt = read <$> getLine

getString :: IO String
getString = getLine
