#include <bits/stdc++.h>
using namespace std;
const int N = 70000 + 1;
int n, s, par[N], part, x[N], ans[N], PAR[N], Bank;
pair<int, int> a[N];
bool dp[N], mark[N];
int main(int argc, const char* argv[]) {
  scanf("%d %d", &n, &s);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i].first);
    x[i] = a[i].first;
    a[i].second = i;
    ;
  }
  sort(a + 1, a + n + 1);
  int ns = s - a[n].first;
  dp[0] = 1, par[0] = -1;
  for (int i = 1; i < n; i++) {
    part += a[i].first;
    for (int j = min(part, ns); j >= a[i].first; j--)
      if (dp[j - a[i].first] && !par[j]) dp[j] = 1, par[j] = i;
    if (dp[ns]) break;
  }
  if (!dp[ns]) {
    cout << -1;
    return 0;
  }
  int X = ns;
  while (par[X] != -1) {
    mark[par[X]] = 1;
    Bank++;
    X = X - a[par[X]].first;
  }
  if (Bank == n - 1) {
    for (int i = 1; i <= n; i++) cout << x[i] << " " << 0 << endl;
    return 0;
  }
  int last = n;
  for (int i = n - 1; i > 0; i--) {
    if (mark[i]) continue;
    ans[a[last].second] = x[a[last].second] - a[i].first;
    PAR[a[last].second] = a[i].second;
    last = i;
  }
  for (int i = 1; i <= n; i++) {
    if (PAR[i] != 0)
      printf("%d 1 %d\n", ans[i], PAR[i]);
    else
      printf("%d 0\n", x[i]);
  }
  return 0;
}
