#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int n, k = 0;
long long int s;
cin >> n >> s;
unsigned long long int *t = new unsigned long long int[n];
unsigned long long int *r = new unsigned long long int[n];
int *result = new int[n];
for (int i = 0; i < n; i++)
{
cin >> t[i];
}
for (int i = 0; i < n; i++)
{
cin >> r[i];
}
for (int i = 0; i < n; i++)
{
result[i] = r[i] - t[i];
}
sort(result, result + n);
for (int i = n - 1; i >= 0; i--)
{
s += result[i];
if (s > 0)
{
k++;
}
else
{
if (i != 0)
{
cout << k + 1 << endl;
return 0;
}
cout << k << endl;
return 0;
}
}
cout << k << endl;
return 0;
}
Copy