#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
long long a[1000001];
void solve() {
long long n, s;
cin >> n >> s;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
long long x;
for (int i = 0; i < n; i++) {
cin >> x;
a[i] = x - a[i];
}
sort(a, a + n);
reverse(a, a + n);
int i = 0;
for (i; i < n && s>0; i++) {
s += a[i];
}
cout << i;
}
int main() {
int t = 1;
//cin >> t;
while(t--){
solve();
}
}