#include <bits/stdc++.h>
using namespace std;
int n, x;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> x;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  vector<int> b(n);
  for (int i = 0; i < n; i++) {
    b[i] = min(x, a[i]);
    x -= b[i];
  }
  b.back() += x;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    cout << a[i] << " " << b[i] << '\n';
    ans += (a[i] == b[i]);
  }
  cout << ans << '\n';
  return 0;
}
