var
n,i,m,ma,t,j:integer;
b:longint;
a:array[1..10000] of integer;
begin
assign(input,'shelf.in');
assign(output,'shelf.out');
reset(input);
rewrite(output);
//while not(eof) do
//begin
readln(n,b);
ma:=0;
for i:=1 to n do
begin
readln(m);
inc(a[m]);
if m>ma then
ma:=m;
end;
t:=0;
for i:=ma downto 1 do
if a[i]<>0 then
for j:=1 to a[i] do
begin
dec(b,i);
inc(t);
if b<=0 then
begin
writeln(t);
exit;
end;
end;
//end;
close(input);
close(output);
end.