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