let () = Scanf.scanf "%d\n" @@ fun n ->
  let as_ = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun a -> a in
  let bs = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun b -> b in
  Printf.printf "%d\n" @@
  if Array.fold_left ( + ) 0 as_ < Array.fold_left ( + ) 0 bs then -1
  else begin
    let abs = Array.init n @@ fun i -> as_.(i) - bs.(i) in
    Array.sort (fun ab ab' -> compare ab' ab) abs;
    let lack = Array.fold_left (fun acc ab -> acc - min 0 ab) 0 abs in
    Array.fold_left (fun acc ab -> acc + if ab < 0 then 1 else 0) 0 abs
    + fst (Array.fold_left (fun (n, lack) ab ->
      if ab <= 0 || lack <= 0 then (n, lack)
      else (n + 1, lack - ab)) (0, lack) abs)
  end
