#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N, x, a[110];
  cin >> N >> x;
  for (long long i = 0; i < N; i++) cin >> a[i];
  sort(a, a + N);
  int cnt = 0;
  for (long long i = 0; i < N; i++) {
    if (x >= a[i]) {
      x -= a[i];
      cnt++;
    }
    cout << cnt << " " << x << endl;
  }
  if (x > 0 && cnt > 0) cnt--;
  cout << cnt << endl;
}
