Program CardsStack;
Uses Math;

Const MaxN=5000; //maximal pile height
      MaxS=50000; //maximal money

Var f: Text;
    S: LongInt;  // talers (at start)
    N: LongInt;  // cards amount
    A, minA: Array [0..MaxN] of LongInt;
    k, i: LongInt;
    price: LongInt;
Begin
//  Assign(f, 'pile.in'); Reset(f);
  Readln(N, S);
  A[0]:= 0;
  minA[0]:= 0;
  For i:= 1 To N Do Begin
    A[i]:= MaxS+1;
    minA[i]:= MaxS+1;
  End;

  For k:= 1 To N Do Begin
  { Process card #k }
    Readln(price);
    For i:= K DownTo 1 Do Begin
      A[i]:= min (A[i]+1, A[i-1]+price);
      If minA[i]>A[i] Then minA[i]:= A[i];
    End;
    Inc(A[0]);
  End;
//  Close(f);

  {Output}
  i:= N;
//  Assign(f, 'pile.out'); Rewrite(f);
  While (minA[i]>S) Do Begin
    Dec(i);
  End;
  Writeln(i);
  Writeln(minA[i]);
//  Close(f);
End.
