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