#include <bits/stdc++.h>
using namespace std;
template <typename T, typename L>
inline bool smax(T &x, L y) {
  return x < y ? (x = y, true) : false;
}
template <typename T, typename L>
inline bool smin(T &x, L y) {
  return y < x ? (x = y, true) : false;
}
constexpr int MAXN = 7e4 + 15;
int n, s;
int dp[MAXN];
set<int> d;
pair<int, int> a[MAXN];
vector<int> ans[MAXN];
int sm;
bool mark[MAXN];
int main() {
  scanf("%d%d", &n, &s);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i].first);
    sm += a[i].first;
    a[i].second = i;
    ans[i].push_back(a[i].first);
  }
  if (sm == s) {
    for (int i = 1; i <= n; i++) {
      cout << a[i].first << " 0\n";
    }
    return false;
  }
  sort(a + 1, a + n + 1);
  if (s < a[n].first) {
    return cout << "-1\n", false;
  }
  memset(dp, -1, sizeof dp);
  dp[0] = 0;
  int mx = 0;
  for (int i = 1; i < n; i++) {
    for (int j = 0; j <= mx; j++) {
      if (j + a[i].first <= s)
        if (dp[j] != -1 && dp[j + a[i].first] == -1 && dp[j] != i) {
          if (mx < j + a[i].first) mx = j + a[i].first;
          dp[j + a[i].first] = i;
        }
      if (dp[s - a[n].first] != -1) break;
    }
    if (dp[s - a[n].first] != -1) break;
  }
  if (dp[s - a[n].first] == -1) {
    return cout << "-1\n", false;
  }
  dp[s] = n;
  int x = s;
  while (x) {
    d.insert(dp[x]);
    x -= a[dp[x]].first;
  }
  for (auto i : d) {
    mark[i] = true;
  }
  for (int i = 1; i <= n; i++) {
    if (!mark[i]) {
      ans[a[i + 1].second].push_back(a[i].second);
      ans[a[i + 1].second][0] -= a[i].first;
    }
  }
  for (int i = 1; i <= n; i++) {
    printf("%d %d ", ans[i][0], ans[i].size() - 1);
    for (int j = 1; j < (int)ans[i].size(); j++) printf("%d ", ans[i][j]);
    printf("\n");
  }
  return false;
}
