<?php
//error_reporting(0);
//$N = trim(fgets(STDIN));
list($N,$x) = explode(" ",trim(fgets(STDIN)));
$a = explode(" ",trim(fgets(STDIN)));
sort($a);
$res = 0;
for($i=0;$i<$N;$i++) {
 $x = $x - $a[$res];
 if ($x < 0) break;
 if ($x >= 0) {
   $res++;
 }
 printf("%d %d\n",$x,$res);
}
if ($x > 0) {
  $res--;
}
printf("%d\n",$res);
