#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int n,k;
cin>>n>>k;
int a[n];
for(int i=0;i<n;i++)
cin>>a[i];
sort(a,a+n);
int s=0,i=0;
while(s<=k)
{
s+=a[i];
i++;
}
cout<<i-1<<endl;
return 0;
}
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int n,k;
cin>>n>>k;
int a[n];
for(int i=0;i<n;i++)
cin>>a[i];
sort(a,a+n);
int s=0,i=0;
while(s<=k)
{
s+=a[i];
i++;
}
cout<<i-1<<endl;
return 0;
}
Pokies Casino - New Jersey
ReplyDeletePokies Casino is the newest and 벳 매니아 fastest-growing 온카 casino online. Get an 365 bet exciting online 벳 티비 casino experience with online Pokies at the best NJ 바카라 몬 casinos. Get your