import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T

main :: IO ()
main = do
  let
    unsafeBinaryMinInt :: (Int -> Bool) -> (Int, Int) -> Int
    unsafeBinaryMinInt p = check
      where
        check :: (Int, Int) -> Int
        check ij@(i, _) | p i       = i
                        | otherwise = search ij
        search :: (Int, Int) -> Int
        search = snd . until ((==) <$> succ . fst <*> snd) halve
          where
            halve :: (Int, Int) -> (Int, Int)
            halve (i, j) | p m       = (i, m)
                         | otherwise = (m, j)
              where
                m = (i + j) `div` 2
  [_, k] <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  as <- map (subtract 1 . unsafeTextToInt) . T.words <$> T.getLine :: IO [Int]
  let
    p :: Int -> Bool
    p i = (<= k) . sum . map (`div` i) $ as
  print $  unsafeBinaryMinInt p (1, 10 ^ 9)

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
{-# INLINE unsafeTextToInt #-}
