main = do
  line <- getLine
  inK <- getLine
  let
    k = read inK :: Int
    func line n
      | n == 0           = '1'
      | head line == '1' = func (tail line) (n-1)
      | otherwise        = head line
    in 
      putStrLn $ [func line k]
