program keyence2019
  implicit none
  integer n, i, ans
  integer(8) s
  integer(8), dimension(:), allocatable :: a, b, c

  read *, n
  allocate(a(n), b(n), c(n))
  read *, a, b
  c = a - b
  c = sort_desc(c)
  s = sum(pack(c, c < 0))
  ans = count(c < 0)
  do i = 1, n
     if (s >= 0 .or. c(i) <= 0) exit
     s = s + c(i)
     ans = ans + 1
  end do
  if (s < 0) then
     print '(a)', '-1'
  else
     print '(i0)', ans
  end if
contains
  recursive function sort_desc(a) result(res)
    integer(8), dimension(:), allocatable :: res
    integer(8), dimension(:), intent(in) :: a

    if (size(a) < 2) then
       res = a
    else
       res = [sort_desc(pack(a(2:), a(2:) > a(1))), a(1), sort_desc(pack(a(2:), a(2:) <= a(1)))]
    end if
  end function sort_desc
end program keyence2019
