import Control.Applicative

main :: IO ()
main = solve <$> getLine <*> readLn >>= putStrLn

solve :: String -> Int -> String
solve ss k = foldr f "1" $ take (min (length ss) k) ss
  where f c i | c /= '1' = [c]
              | otherwise = i
