#include <bits/stdc++.h>
using namespace std;
map<pair<int, int>, int> vst;
pair<int, int> a[70010], ans[70010];
long long sum[70010];
int used[70010], nn, nxt[70010];
bool solve(int st, int s) {
  if (s == 0) return true;
  if (sum[st] < s) return false;
  if (vst.count(pair<int, int>(st, s))) return false;
  vst[pair<int, int>(st, s)] = 1;
  if (a[st].first <= s) {
    used[st] = 1;
    if (solve(st + 1, s - a[st].first)) return true;
    used[st] = 0;
  }
  return solve(st + 1, s);
}
int main() {
  int n, s;
  cin >> n >> s;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i].first);
    a[i].second = i;
  }
  sort(a, a + n);
  reverse(a, a + n);
  for (int i = n - 1; i >= 0; i--) sum[i] = sum[i + 1] + a[i].first;
  s -= a[0].first;
  used[0] = 1;
  if (s < 0) return puts("-1");
  if (!solve(1, s)) return puts("-1");
  used[0] = 0;
  int pos = -1;
  for (int i = n - 1; i >= 0; i--)
    if (!used[i]) nxt[i] = pos, pos = i;
  for (int i = 0; i < n; i++) {
    if (used[i] || nxt[i] == -1) {
      ans[a[i].second] = pair<int, int>(a[i].first, -1);
    } else
      ans[a[i].second] =
          pair<int, int>(a[i].first - a[nxt[i]].first, a[nxt[i]].second);
  }
  for (int i = 0; i < n; i++) {
    if (ans[i].second >= 0)
      printf("%d 1 %d\n", ans[i].first, ans[i].second + 1);
    else
      printf("%d %d\n", ans[i].first, ans[i].second + 1);
  }
  return 0;
}
