#include <bits/stdc++.h>
using namespace std;
int main() {
//freopen("cubes.in", "r", stdin);
//freopen ("output.txt","w",stdout);
int t = 1;
// cin >> t;
for (int j = 0; j < t; j++) {
long long n, s;
cin >> n >> s;
vector<long long> a(n), b(n);
for(long long &x : a) cin >> x;
for(long long &x : b) cin >> x;
vector<long long> ans(n);
for(long long i = 0; i < n; i++) ans[i] = b[i] - a[i];
sort(ans.begin(), ans.end());
reverse(ans.begin(), ans.end());
int i = 0;
while(s > 0 && i < n) {
s += ans[i++];
}
cout << i << endl;
}
return 0;
}
Copy