/*input
12
757232153 372327760 440075441 195848680 354974235 458054863 463477172 740174259 615762794 632963102 529866931 64991604
74164189 98239366 465611891 362739947 147060907 118867039 63189252 78303147 501410831 110823640 122948912 572905212
*/

#include <iostream>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <utility>
#include <vector>
#include <map>
#include <algorithm>
#include <set>
#include <stdlib.h>

using namespace std;

#define pb                push_back
#define pp                pop_back
#define pf                pop_front
#define nl                cout << "\n"
#define MIN(con)          (*min_element(ALL(con))) 
#define MAX(con)          (*max_element(ALL(con)))
#define ALL(cont)         (cont).begin(),(cont).end()
#define NX(cont)          next_permutation(ALL(cont))
#define PX(cont)          prev_permutation(ALL(cont))
#define prec(n)           cout << fixed << setprecision(n)
#define PI                3.14159265358979323846264338327951
#define FH(it,c)          for(__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++ it)
#define ff                first
#define ss                second
#define all(c)            c.begin(),c.end()
#define fill(a,v)         memset(a,v,sizeof a)
#define rep(i,a,b)        for(ll i=a;i<b;i++)
#define rrep(i,a,b)       for(ll i=a;i>=b;i--)
#define srep(i,s)         for(ll i=0;s[i]!='\0';i++)
#define nn                cout<<"\n"
#define sp                cout<<" "
#define mod               1000000007    //9
#define ifalse            ios_base::sync_with_stdio(false),cin.tie(NULL)

using ll = long long;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<string> vst;
typedef pair<ll,ll> pll;
typedef pair<char,ll> pcl;
typedef pair<string,ll> psl;
typedef set<ll> sll;
typedef set<char> sc;
typedef set<string> sst;
typedef map<char,ll> mcl;
typedef map<ll,ll> mll;
typedef map<string,ll> msl;

using ld = long double;
 
template < typename T > inline T LCM(T a, T b)            { return (a * b) / GCD(a, b); }
template < typename T > inline T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > inline string toString(T a)       {return to_string(a); }  // Convert int to string
template < typename T > inline void toInt(string s, T &x) { stringstream str(s); str >> x;}  // Convert string to int

inline ll add(ll x, ll y) { x += y; if(x >= mod) x -= mod; return x; }
inline ll sub(ll x, ll y) { x -= y; if(x < 0) x += mod; return x; }
inline ll mul(ll x, ll y) { return ((x % mod) * (y % mod)) % mod; }

inline ll powr(ll a, ll b){
    ll x = 1LL;
    while(b) {
        if(b & 1) x = mul(x, a);
        a = mul(a, a);
        b >>= 1;
    }
    return x;
}

inline ll inv(ll a) { return powr(a, mod - 2);}

const int inv2 = (mod + 1) >> 1;
const ll INF =  999999999999999999;
const int inf = 999999999;

bool check(ll n)
{
    if(n == 1) return 0;
    if(n == 2 or n == 3) return 1;
    if(n % 2 == 0 or n % 3 == 0) return 0;

    for(ll i = 5; i * i <= n; i += 6) if(n % i == 0 or n % (i + 2) == 0) return 0;
    return 1;
}


/*********************************************START**************************************************************/

int main()
{
    ifalse;
    int n;
    cin >> n;
    vector < ll > v, v1;
    ll sum1 = 0, sum2 =0;
    rep(i, 0, n) {
        ll x;
        cin >> x;
        v.pb(x);
        sum1 += x;
    }
    rep(i, 0, n) {
        ll x;
        cin >> x;
        v1.pb(x);
        sum2 += x;
    }
    if(sum1 < sum2) {
        cout << "-1";
        return 0;
    }
    int u = 0;
    ll sum = 0;
    vector < ll > v2;
    rep(i, 0, n) {
        if(v[i] > v1[i]) {
            v2.pb(v[i] - v1[i]);
        }
        else if(v[i] < v1[i]) {
            u ++;
            sum += (v1[i] - v[i]);
        }
    }
    sort(all(v2), greater < ll > ());
    int cnt = 0;
    for(auto x: v2) {
        if(sum <= 0) {
            break;
        }
        else {
            cnt ++;
            sum -= x;
        }
    }
    cout << cnt + u;
    return 0;
}

Measured memory_bytes: 2804