program main
  implicit none
  integer (8)                               :: M, N, count, i, j, JG
  integer (8), allocatable, dimension ( : ) :: A, B, D, tmp

  read *,N
  allocate ( A ( N ), B ( N ), D ( N ), tmp ( N ) )
  read *, A
  read *, B

  count = 0
  JG = 0
  M = 0

  do i = 1, N
     JG = JG + A ( i ) - B ( i )
  end do

  if ( JG < 0 ) then
     print *,-1
     stop
  end if

  do i = 1, N
     D ( i ) = A ( i ) - B ( i )
     if ( D ( i ) < 0 )  then
        M = M + D ( i )
        count = count + 1
     end if
  end do

  do i = 1, N
     if ( M >= 0 ) exit
     M = M + maxval ( D )
     do j = 1, N
        if ( D ( j ) == maxval ( D ) ) then
           D ( j ) = 0
           exit
        end if
     end do
        count = count + 1
  end do

  print *, count

end program main
