let rv f p q = f q p;;
Scanf.(Array.(scanf " %d" @@ fun n ->
  let a = init n @@ fun _ -> scanf " %d" @@ fun v -> v in
  let b = init n @@ fun _ -> scanf " %d" @@ fun v -> v in
  let tmp = init n (fun i -> b.(i) - a.(i)) |> to_list in
  let need = List.(map (max 0) tmp |> filter ((<>) 0)) in
  let feed = List.(map (min 0) tmp |> filter ((<>) 0)
  |> map (( * ) (-1)) |> sort (rv compare)) in
  let left,res = List.(fold_left (fun (need,res) v ->
    if need = 0 then (need,res)
    else if need <= v then (0,res+1)
    else (need-v,res+1)
  ) (fold_left (+) 0 need,length need) feed) in
  print_int @@ if left > 0 then -1 else res
))