main :: IO ()
main = do
  s <- getString
  k <- getInt
  putStrLn . return . head . (++ "1") . filter (/= '1') . take k $ s

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

getString :: IO String
getString = getLine
