#include <stdio.h>

int main(int argc, char const *argv[])
{
	int N,mini,happy = 0;
	long int x,a[100],min = 1000000000;
	scanf("%d %ld",&N,&x);
	for (int i = 0; i < N; ++i)
	{
		scanf(" %ld",&a[i]);
	}
	while(x){
		for (int i = 0; i < N; ++i)
		{
			if(a[i] < min){
				min = a[i];
				mini = i;
		}
		if(min > x)	break;
		x -= a[mini];
		a[mini] = 0;
		++happy;
	}
	printf("%d\n", happy);
	return 0;
}