
uses crt;
var
        a:array[1..100] of int64;
        x,h,t:int64;
        n,i:longint;

procedure nhap;
var
        i:longint;
begin
        readln(n,x);
        for i:= 1 to n do read(a[i]);
end;

procedure sort(l,r:longint);
var
        i,j,k:longint;
begin
        i:=l;j:=r;
        k:=a[(r+l)div 2 +1];
        repeat
        while a[i]<k do inc(i);
        while a[j]>k do dec(j);
        if i<=j then
           begin
             h:=a[i];
             a[i]:=a[j];
             a[j]:=h;
             inc(i);
             dec(j);
           end;
        until i>j;
        if l<j then sort(l,j);
        if r>i then sort(i,r);
end;

begin
        nhap;
        sort(1,n);
        for i:= 1 to n do
            if x-a[i]>=0 then
               begin
                 x:=x-a[i];
                 t:=i;
               end
            else
            break;
        writeln(t);
        readln;
        readln;
end.