#include <bits/stdc++.h>
using namespace std;
const int N = 70000 + 7;
int n;
int s;
int rad;
int init[N];
int pt[N];
pair<int, int> a[N];
bitset<N> ok;
vector<bitset<N>> memos;
int kido[N];
bool fully[N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> s;
  rad = sqrt(n);
  for (int i = 1; i <= n; i++) {
    cin >> a[i].first;
    a[i].second = i;
    init[i] = a[i].first;
  }
  sort(a + 1, a + n + 1);
  s -= a[n].first;
  if (s < 0) {
    cout << "-1\n";
    return 0;
  }
  ok[0] = 1;
  memos.push_back(ok);
  for (int i = 1; i < n; i++) {
    ok = ok | (ok << a[i].first);
    if (i % rad == 0) {
      memos.push_back(ok);
    }
  }
  if (ok[s] == 0) {
    cout << "-1\n";
    return 0;
  }
  vector<int> ids = {a[n].second}, nt;
  for (int it = n - 1; it >= 0; it--) {
    if (it % rad == 0) {
      int l = it, r = min(n - 1, it + rad - 1);
      vector<bitset<N>> aux;
      ok = memos[it / rad];
      aux.push_back(ok);
      for (int j = l + 1; j <= r; j++) {
        ok = ok | (ok << a[j].first);
        aux.push_back(ok);
      }
      for (int j = r; j >= l; j--) {
        if (aux[j - l][s] == 0) {
          ids.push_back(a[j + 1].second);
          s -= a[j + 1].first;
        } else {
          nt.push_back(a[j + 1].second);
        }
      }
    }
  }
  int test = 0;
  for (auto &i : ids) {
    test += init[i];
  }
  if (nt.empty()) {
    for (int i = 1; i <= n; i++) {
      cout << init[i] << " 0\n";
    }
    return 0;
  }
  for (int i = 1; i < (int)ids.size(); i++) {
    fully[ids[i]] = 1;
  }
  fully[nt.back()] = 1;
  kido[ids[0]] = nt[0];
  for (int i = 0; i + 1 < (int)nt.size(); i++) {
    kido[nt[i]] = nt[i + 1];
  }
  for (int i = 1; i <= n; i++) {
    if (fully[i]) {
      cout << init[i] << " 0\n";
    } else {
      cout << init[i] - init[kido[i]] << " 1 " << kido[i] << "\n";
    }
  }
  return 0;
}
