import Data.List

import Data.Graph.Inductive.Internal.Heap



n_pair::Int->IO([Int],[Int])
n_pair 0 =return ([],[])
n_pair n = do
  c<-getLine
  let x:y:[]=map read (words c)
  (xs,ys)<-n_pair (n-1)
  return (x:xs,y:ys)

strategy::[Int]->[Int]->[Int]
strategy as bs = let usable_b = ((map (\x->(-x))).heapsort.(map (\x->(-x))))  (filter (\x -> x > (maximum as) ) bs) in
                    usable_b++(repeat (maximum as))

hp_dec::Int->[Int]->Int
hp_dec x ys = if x <= 0 then 0 else 1 + (hp_dec (x-(head ys)) (tail ys))


hp_dec_tail::Int->Int-> [Int]->Int
hp_dec_tail n x ys = if x<= 0 then n else hp_dec_tail (n+1) (x -(head ys)) (tail ys)

main::IO()
main=do
  c<-getLine
  let n:hp:[] = map read (words c)
  (as,bs)<-n_pair n
  print (hp_dec_tail 0 hp (strategy as bs))
