#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 sum = 0, count = 0;
  while (sum < x && a[count] > 0) {
    sum += a[count];
    count++;
    cout << a[count] << " " << sum << " " << count << endl;
  }
  cout << count - 1 << endl;
  return 0;
}
