#include <bits/stdc++.h>
using namespace std;
const int maxn = 222222, inf = ~0U >> 1;
int n, s;
int pre[maxn];
unsigned int f[maxn];
struct bag {
  int id, a;
  bool operator<(const bag& o) const { return a < o.a; }
} A[maxn];
int main() {
  cin >> n >> s;
  for (int i = 0; i < n; i++) {
    scanf("%d", &A[i].a);
    A[i].id = i;
  }
  sort(A, A + n);
  s -= A[n - 1].a;
  if (s < 0) {
    puts("-1");
    return 0;
  }
  memset(pre, -1, sizeof pre);
  f[0] = 1;
  int sum = 0;
  int last = 0;
  for (int i = 0; i < n - 1; i++)
    if (!f[s] && s >= A[i].a) {
      for (int j = min(s - A[i].a, sum); j >= min(0, last + 1 - A[i].a); --j)
        if (!f[j + A[i].a] && f[j]) f[j + A[i].a] = 1, pre[j + A[i].a] = i;
      sum += A[i].a;
      while (f[last + 1]) last++;
    } else
      break;
  if (-1 == pre[s] && s != 0) {
    puts("-1");
    return 0;
  }
  vector<int> ans(n), Pre(n);
  static bool add[maxn];
  memset(add, (0), sizeof(add));
  int cnt = 0, c = 0;
  for (int i = pre[s]; i != -1; s -= A[i].a, i = pre[s])
    add[i] = true, cnt++, c += A[i].a;
  if (s) {
    puts("-1");
    return 0;
  }
  int p = -1;
  for (int i = 0; i < n - 1; i++)
    if (add[i])
      ans[A[i].id] = A[i].a, Pre[A[i].id] = -1;
    else {
      if (p == -1)
        ans[A[i].id] = A[i].a, Pre[A[i].id] = -1;
      else
        ans[A[i].id] = A[i].a - A[p].a, Pre[A[i].id] = p;
      p = i;
    }
  for (int i = 0; i < n; i++)
    if (A[n - 1].id != i) {
      printf("%d", ans[i]);
      if (Pre[i] == -1)
        printf(" 0\n");
      else
        printf(" 1 %d\n", A[Pre[i]].id + 1);
    } else {
      if (p != -1)
        printf("%d %d %d\n", A[n - 1].a - A[p].a, 1, A[p].id + 1);
      else
        printf("%d %d\n", A[n - 1].a, 0);
    }
}
