#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 7e4 + 10;
long long n, second, mx, arr[MAXN], prs, par[MAXN], cnt, p[MAXN], ans[MAXN];
pair<long long, long long> a[MAXN];
bool dp[MAXN], bo[MAXN];
int32_t main() {
  cin >> n >> second;
  for (long long i = 1; i <= n; i++)
    cin >> a[i].first, a[i].second = i, arr[i] = a[i].first,
                       mx = max(mx, a[i].first);
  sort(a + 1, a + n + 1);
  dp[0] = true, par[0] = -1;
  long long sp = second - mx;
  for (long long i = 1; i < n; i++) {
    prs += a[i].first;
    for (long long j = min(prs, sp); j >= a[i].first; j--)
      if (!par[j] and dp[j - a[i].first]) dp[j] = true, par[j] = i;
    if (dp[sp]) break;
  }
  if (!dp[sp]) return cout << -1 << endl, 0;
  long long S = sp;
  while (par[S] != -1) bo[par[S]] = true, cnt++, S -= a[par[S]].first;
  if (cnt == n - 1) {
    for (long long i = 1; i <= n; i++) cout << arr[i] << " " << 0 << endl;
    return 0;
  }
  long long l = n;
  for (long long i = n - 1; i > 0; i--) {
    if (bo[i]) continue;
    ans[a[l].second] = arr[a[l].second] - a[i].first,
    p[a[l].second] = a[i].second, l = i;
  }
  for (long long i = 1; i <= n; i++)
    if (p[i])
      cout << ans[i] << " " << 1 << " " << p[i] << endl;
    else
      cout << arr[i] << " " << 0 << endl;
  return 0;
}
