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