let rec eat x lst = match lst with
	| a::b::xs -> if a + b > x
					then 1 + eat x (a::(b-1):: xs)
					else eat x (b::xs)
	| a::xs -> 0
	| [] -> 0

let _ =
	let f = Scanf.scanf "%d %d\n" (fun x y -> eat y) in
	read_line () |> Str.split (Str.regexp " ") |> List.map(fun x -> int_of_string x)|> f |> Printf.printf "%d"
