#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N, x;
  cin >> N >> x;
  vector<int> child(N);
  for (int i = 0; i < N; i++) {
    cin >> child.at(i);
  }
  sort(child.begin(), child.end());
  int res = 0;
  for (int i = 0; x > 0 && i < N; i++) {
    cout << x << " " << child.at(i) << endl;
    if (child.at(i) <= x) {
      if (i == N - 1 && x != child.at(i)) {
        res--;
      }
      x -= child.at(i);
      res++;
    }
  }
  cout << res << endl;
  return 0;
}
