// olaf_surgut
#include <bits/stdc++.h>

using namespace std;

const int N = 1e4 + 7;

int n, s, id[N], a[N];

bitset<N> dp[N];

int cnt[N];
vector<int> ans[N];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> n >> s;
    for(int i = 0; i < n; i++) cin >> a[i];
    iota(id, id + n, 0);
    sort(id, id + n, [&](int i, int j) { return a[i] > a[j]; });

    dp[0][a[id[0]]] = true;
    for(int i = 1; i < n; i++) {
        dp[i] = dp[i - 1] | (dp[i - 1] << a[id[i]]);
    }

    if(!dp[n - 1][s]) {
        cout << "-1\n";
        return 0;
    }

    vector<int> roots;

    int i = n - 1, j = s;
    while(i >= 0) {
        if(j >= a[id[i]] && (i == 0 || dp[i - 1][j - a[id[i]]])) {
            roots.push_back(id[i]);
            j -= a[id[i]];
        }
        i--;
    }

    int big_root = roots.back();
    roots.pop_back();

    for(int r : roots)  cnt[r] = a[r];

    vector<int> rest;
    for(int i = 0; i < n; i++) {
        if(cnt[i] == 0 && i != big_root) {
            rest.push_back(i);
        }
    }

    sort(rest.begin(), rest.end(), [&](int i, int j) { return a[i] > a[j]; });

    for(int i : rest) {
        cnt[big_root] = a[big_root] - a[i];
        ans[big_root].push_back(i);
        big_root = i;
    }
    cnt[rest.back()] = a[rest.back()];

    for(int i = 0; i < n; i++) {
        cout << cnt[i] << ' ' << ans[i].size() << ' ';
        for(int x : ans[i]) cout << x + 1 << ' ';
        cout << '\n';
    }
}


// olaf_surgut
#include <bits/stdc++.h>

using namespace std;

const int N = 7e4 + 7;
#warning change N

int n, s, id[N], a[N];

vector<int> indexx[N];

bitset<N> dp;
bitset<N> num;

int cnt[N];
vector<int> ans[N];

int maxi = -1;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> n >> s;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        maxi = max(maxi, a[i]);
        indexx[a[i]].push_back(i);
        num[N - 1 - a[i]] = true;
    }
    assert(maxi != -1);
    iota(id, id + n, 0);
    sort(id, id + n, [&](int i, int j) { return a[i] > a[j]; });

    dp[a[id[0]]] = true;
    for(int i = 1; i < n; i++)  dp |= (dp << a[id[i]]);
    dp[0] = true;

    if(!dp[s]) {
        cout << "-1\n";
        return 0;
    }

    vector<int> values;
    for(int i = s; i > 0; ) {
        int x = (dp & (num >> (N - 1 - i)))._Find_first();
        values.push_back(i - x);
        i -= values.back();
    }

    vector<int> roots;
    int big_root = -1;

    for(int v : values) {
        assert(indexx[v].size());

        if(big_root == -1 && v == maxi) {
            big_root = indexx[v].back();
        } else {
            roots.push_back(indexx[v].back());
        }
        indexx[v].pop_back();
    }

    for(int r : roots)  cnt[r] = a[r];

    vector<int> rest;
    for(int i = 0; i < n; i++) {
        if(cnt[i] == 0 && i != big_root) {
            rest.push_back(i);
        }
    }

    sort(rest.begin(), rest.end(), [&](int i, int j) { return a[i] > a[j]; });

    for(int i : rest) {
        cnt[big_root] = a[big_root] - a[i];
        ans[big_root].push_back(i);
        big_root = i;
    }
    cnt[rest.back()] = a[rest.back()];

    for(int i = 0; i < n; i++) {
        cout << cnt[i] << ' ' << ans[i].size() << ' ';
        for(int x : ans[i]) cout << x + 1 << ' ';
        cout << '\n';
    }
}


// olaf_surgut
#include <bits/stdc++.h>

using namespace std;

const int N = 12;
#warning change N

int n, s, id[N], a[N];

vector<int> indexx[N];

bitset<N> dp;
bitset<N> num;

int cnt[N];
vector<int> ans[N];

int maxi = -1;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> n >> s;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        maxi = max(maxi, a[i]);
        indexx[a[i]].push_back(i);
        num[N - 1 - a[i]] = true;
    }
    assert(maxi != -1);
    iota(id, id + n, 0);
    sort(id, id + n, [&](int i, int j) { return a[i] > a[j]; });

    dp[a[id[0]]] = true;
    for(int i = 1; i < n; i++)  dp |= (dp << a[id[i]]);
    dp[0] = true;

    if(!dp[s]) {
        cout << "-1\n";
        return 0;
    }

    vector<int> values;
    for(int i = s; i > 0; ) {
        int x = (dp & (num >> (N - 1 - i)))._Find_first();
        values.push_back(i - x);
        i -= values.back();
    }

    vector<int> roots;
    int big_root = -1;

    for(int v : values) {
        assert(indexx[v].size());

        if(big_root == -1 && v == maxi) {
            big_root = indexx[v].back();
        } else {
            roots.push_back(indexx[v].back());
        }
        indexx[v].pop_back();
    }

    for(int r : roots)  cnt[r] = a[r];

    vector<int> rest;
    for(int i = 0; i < n; i++) {
        if(cnt[i] == 0 && i != big_root) {
            rest.push_back(i);
        }
    }

    sort(rest.begin(), rest.end(), [&](int i, int j) { return a[i] > a[j]; });

    for(int i : rest) {
        cnt[big_root] = a[big_root] - a[i];
        ans[big_root].push_back(i);
        big_root = i;
    }
    cnt[rest.back()] = a[rest.back()];

    for(int i = 0; i < n; i++) {
        cout << cnt[i] << ' ' << ans[i].size() << ' ';
        for(int x : ans[i]) cout << x + 1 << ' ';
        cout << '\n';
    }
}


// olaf_surgut
#include <bits/stdc++.h>

using namespace std;

const int N = 7e4 + 7;

int n, s, id[N], a[N];

vector<int> indexx[N];

bitset<N> dp;
bitset<N> num;

int cnt[N];
vector<int> ans[N];

int maxi = -1;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> n >> s;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        maxi = max(maxi, a[i]);
        indexx[a[i]].push_back(i);
        num[N - 1 - a[i]] = true;
    }
    assert(maxi != -1);
    iota(id, id + n, 0);
    sort(id, id + n, [&](int i, int j) { return a[i] > a[j]; });

    dp[a[id[0]]] = true;
    for(int i = 1; i < n; i++)  dp |= (dp << a[id[i]]);
    dp[0] = true;

    if(!dp[s]) {
        cout << "-1\n";
        return 0;
    }

    vector<int> values;
    for(int i = s; i > 0; ) {
        int x = (dp & (num >> (N - 1 - i)))._Find_first();
        values.push_back(i - x);
        assert(values.back() > 0);
        i -= values.back();
    }
    assert(values.size());

    vector<int> roots;
    int big_root = -1;

    for(int v : values) {
        assert(indexx[v].size());

        if(big_root == -1 && v == maxi) {
            big_root = indexx[v].back();
        } else {
            roots.push_back(indexx[v].back());
        }
        indexx[v].pop_back();
    }

    assert(big_root != -1);

    for(int r : roots)  cnt[r] = a[r];

    vector<int> rest;
    for(int i = 0; i < n; i++) {
        if(cnt[i] == 0 && i != big_root) {
            rest.push_back(i);
        }
    }

    sort(rest.begin(), rest.end(), [&](int i, int j) { return a[i] > a[j]; });

    for(int i : rest) {
        cnt[big_root] = a[big_root] - a[i];
        ans[big_root].push_back(i);
        big_root = i;
    }
    if(rest.size()) cnt[rest.back()] = a[rest.back()];
    else            cnt[big_root] = a[big_root];

    for(int i = 0; i < n; i++) {
        cout << cnt[i] << ' ' << ans[i].size() << ' ';
        for(int x : ans[i]) cout << x + 1 << ' ';
        cout << '\n';
    }
}


// olaf_surgut
#include <bits/stdc++.h>

using namespace std;

const int N = 7e4 + 7;

int n, s, id[N], a[N], st[N];
bitset<N> dp;

int cnt[N];
vector<int> ans[N];

int maxi = -1;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> n >> s;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        maxi = max(maxi, a[i]);
    }
    iota(id, id + n, 0);
    sort(id, id + n, [&](int i, int j) { return a[i] > a[j]; });

    dp[a[id[0]]] = true;
    for(int i = 1; i < n; i++) {
        bitset<N> x = dp;
        dp |= (dp << a[i]);

        x &= dp;

        for(int j = x._Find_first(); j < (int) x.size(); j = x._Find_next(j))
            st[j] = i;
    }

    if(!dp[s]) {
        cout << "-1\n";
        return 0;
    }

    vector<int> roots;
    int big_root = -1;

    for(int i = s; i > 0; ) {
        int j = id[st[i]];
        if(big_root == -1 && a[j] == maxi) {
            big_root = j;
        } else {
            roots.push_back(j);
        }
        i -= a[j];
    }

    for(int r : roots)  cnt[r] = a[r];

    vector<int> rest;
    for(int i = 0; i < n; i++) {
        if(cnt[i] == 0 && i != big_root) {
            rest.push_back(i);
        }
    }

    sort(rest.begin(), rest.end(), [&](int i, int j) { return a[i] > a[j]; });

    for(int i : rest) {
        cnt[big_root] = a[big_root] - a[i];
        ans[big_root].push_back(i);
        big_root = i;
    }
    if(rest.size()) cnt[rest.back()] = a[rest.back()];
    else            cnt[big_root] = a[big_root];

    for(int i = 0; i < n; i++) {
        cout << cnt[i] << ' ' << ans[i].size() << ' ';
        for(int x : ans[i]) cout << x + 1 << ' ';
        cout << '\n';
    }
}


// olaf_surgut
#include <bits/stdc++.h>

using namespace std;

const int N = 7e4 + 7;

int n, s, id[N], a[N], st[N];
bitset<N> dp;

int cnt[N];
vector<int> ans[N];

int maxi = -1;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> n >> s;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        maxi = max(maxi, a[i]);
    }
    iota(id, id + n, 0);
    sort(id, id + n, [&](int i, int j) { return a[i] > a[j]; });

    dp[a[id[0]]] = true; st[a[id[0]]] = id[0];
    for(int i = 1; i < n; i++) {
        bitset<N> x = dp;
        dp |= (dp << a[id[i]]);

        x ^= dp;

        for(int j = x._Find_first(); j < (int) x.size(); j = x._Find_next(j))
            st[j] = id[i];
    }

    if(!dp[s]) {
        cout << "-1\n";
        return 0;
    }

    vector<int> roots;
    int big_root = -1;

    for(int i = s; i > 0; ) {
        int j = st[i];
        if(big_root == -1 && a[j] == maxi) {
            big_root = j;
        } else {
            roots.push_back(j);
        }
        i -= a[j];
    }

    for(int r : roots)  cnt[r] = a[r];

    vector<int> rest;
    for(int i = 0; i < n; i++) {
        if(cnt[i] == 0 && i != big_root) {
            rest.push_back(i);
        }
    }

    sort(rest.begin(), rest.end(), [&](int i, int j) { return a[i] > a[j]; });

    for(int i : rest) {
        cnt[big_root] = a[big_root] - a[i];
        ans[big_root].push_back(i);
        big_root = i;
    }
    if(rest.size()) cnt[rest.back()] = a[rest.back()];
    else            cnt[big_root] = a[big_root];

    for(int i = 0; i < n; i++) {
        cout << cnt[i] << ' ' << ans[i].size() << ' ';
        for(int x : ans[i]) cout << x + 1 << ' ';
        cout << '\n';
    }
}


// olaf_surgut
#include <bits/stdc++.h>

using namespace std;

const int N = 7e4 + 7;
#warning change N

int n, s, id[N], a[N];

vector<int> indexx[N];

bitset<N> dp;
bitset<N> num;

int cnt[N];
vector<int> ans[N];

int maxi = -1;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> n >> s;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        maxi = max(maxi, a[i]);
        indexx[a[i]].push_back(i);
        num[N - 1 - a[i]] = true;
    }
    assert(maxi != -1);
    iota(id, id + n, 0);
    sort(id, id + n, [&](int i, int j) { return a[i] > a[j]; });

    dp[a[id[0]]] = true;
    for(int i = 1; i < n; i++)  dp |= (dp << a[id[i]]);
    dp[0] = true;

    if(!dp[s]) {
        cout << "-1\n";
        return 0;
    }

    vector<int> values;
    for(int i = s; i > 0; ) {
        int x = (dp & (num >> (N - 1 - i)))._Find_first();
        values.push_back(i - x);
        i -= values.back();
    }

    vector<int> roots;
    int big_root = -1;

    for(int v : values) {
        assert(indexx[v].size());

        if(big_root == -1 && v == maxi) {
            big_root = indexx[v].back();
        } else {
            roots.push_back(indexx[v].back());
        }
        indexx[v].pop_back();
    }

    for(int r : roots)  cnt[r] = a[r];

    vector<int> rest;
    for(int i = 0; i < n; i++) {
        if(cnt[i] == 0 && i != big_root) {
            rest.push_back(i);
        }
    }

    sort(rest.begin(), rest.end(), [&](int i, int j) { return a[i] > a[j]; });

    for(int i : rest) {
        cnt[big_root] = a[big_root] - a[i];
        ans[big_root].push_back(i);
        big_root = i;
    }
    if(rest.size()) cnt[rest.back()] = a[rest.back()];
    else            cnt[big_root] = a[big_root];

    for(int i = 0; i < n; i++) {
        cout << cnt[i] << ' ' << ans[i].size() << ' ';
        for(int x : ans[i]) cout << x + 1 << ' ';
        cout << '\n';
    }
}


// olaf_surgut
#include <bits/stdc++.h>

using namespace std;

const int N = 7e4 + 7;

int n, s, id[N], a[N];

vector<int> indexx[N];

bitset<N> dp;
bitset<N> num;

int cnt[N];
vector<int> ans[N];

int maxi = -1;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> n >> s;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        maxi = max(maxi, a[i]);
        indexx[a[i]].push_back(i);
        num[N - 1 - a[i]] = true;
    }
    assert(maxi != -1);
    iota(id, id + n, 0);
    sort(id, id + n, [&](int i, int j) { return a[i] > a[j]; });

    dp[a[id[0]]] = true;
    for(int i = 1; i < n; i++)  dp |= (dp << a[id[i]]);
    dp[0] = true;

    if(!dp[s]) {
        cout << "-1\n";
        return 0;
    }

    vector<int> roots;
    int big_root = -1;

    for(int i = s; i > 0; ) {
        bitset<N> x = (dp & (num >> (N - 1 - i)));

        for(int j = x._Find_first(); j < (int) x.size(); j = x._Find_next(j)) {
            int a = i - j;
            if(indexx[a].size()) {
                i -= a;

                if(big_root == -1 && maxi == a) {
                    big_root = indexx[a].back();
                } else {
                    roots.push_back(indexx[a].back());
                }

                indexx[a].pop_back();

                break;
            }
        }
    }

    for(int r : roots)  cnt[r] = a[r];

    vector<int> rest;
    for(int i = 0; i < n; i++) {
        if(cnt[i] == 0 && i != big_root) {
            rest.push_back(i);
        }
    }

    sort(rest.begin(), rest.end(), [&](int i, int j) { return a[i] > a[j]; });

    for(int i : rest) {
        cnt[big_root] = a[big_root] - a[i];
        ans[big_root].push_back(i);
        big_root = i;
    }
    if(rest.size()) cnt[rest.back()] = a[rest.back()];
    else            cnt[big_root] = a[big_root];

    for(int i = 0; i < n; i++) {
        cout << cnt[i] << ' ' << ans[i].size() << ' ';
        for(int x : ans[i]) cout << x + 1 << ' ';
        cout << '\n';
    }
}


// olaf_surgut
#include <bits/stdc++.h>

using namespace std;

const int N = 7e4 * 2;

int n, s, id[N], a[N];

vector<int> indexx[N];

bitset<N> dp;
bitset<N> num;

int cnt[N];
vector<int> ans[N];

int maxi = -1;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> n >> s;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        maxi = max(maxi, a[i]);
        indexx[a[i]].push_back(i);
        num[N - 1 - a[i]] = true;
    }
    iota(id, id + n, 0);
    sort(id, id + n, [&](int i, int j) { return a[i] > a[j]; });

    dp[a[id[0]]] = true;
    for(int i = 1; i < n; i++)  dp |= (dp << a[id[i]]);
    dp[0] = true;

    if(!dp[s]) {
        cout << "-1\n";
        return 0;
    }

    vector<int> values;
    for(int i = s; i > 0; ) {
        int x = (dp & (num >> (N - 1 - i)))._Find_first();
        values.push_back(i - x);
        i -= values.back();
    }

    vector<int> roots;
    int big_root = -1;

    for(int v : values) {
        if(big_root == -1 && v == maxi) {
            big_root = indexx[v].back();
        } else {
            roots.push_back(indexx[v].back());
        }
        indexx[v].pop_back();
    }

    for(int r : roots)  cnt[r] = a[r];

    vector<int> rest;
    for(int i = 0; i < n; i++) {
        if(cnt[i] == 0 && i != big_root) {
            rest.push_back(i);
        }
    }

    sort(rest.begin(), rest.end(), [&](int i, int j) { return a[i] > a[j]; });

    for(int i : rest) {
        cnt[big_root] = a[big_root] - a[i];
        ans[big_root].push_back(i);
        big_root = i;
    }
    if(rest.size()) cnt[rest.back()] = a[rest.back()];
    else            cnt[big_root] = a[big_root];

    for(int i = 0; i < n; i++) {
        cout << cnt[i] << ' ' << ans[i].size() << ' ';
        for(int x : ans[i]) cout << x + 1 << ' ';
        cout << '\n';
    }
}


// olaf_surgut
#include <bits/stdc++.h>

using namespace std;

const int N = 7e4 + 7;

int n, s, id[N], a[N];

bitset<N> dp[N];

int cnt[N];
vector<int> ans[N];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> n >> s;
    for(int i = 0; i < n; i++) cin >> a[i];
    iota(id, id + n, 0);
    sort(id, id + n, [&](int i, int j) { return a[i] > a[j]; });

    dp[0][a[id[0]]] = true;
    for(int i = 1; i < n; i++) {
        dp[i] = dp[i - 1] | (dp[i - 1] << a[id[i]]);
    }

    if(!dp[n - 1][s]) {
        cout << "-1\n";
        return 0;
    }

    vector<int> roots;

    int i = n - 1, j = s;
    while(i >= 0) {
        if(j >= a[id[i]] && (i == 0 || dp[i - 1][j - a[id[i]]])) {
            roots.push_back(id[i]);
            j -= a[id[i]];
        }
        i--;
    }

    int big_root = roots.back();
    roots.pop_back();

    for(int r : roots)  cnt[r] = a[r];

    vector<int> rest;
    for(int i = 0; i < n; i++) {
        if(cnt[i] == 0 && i != big_root) {
            rest.push_back(i);
        }
    }

    sort(rest.begin(), rest.end(), [&](int i, int j) { return a[i] > a[j]; });

    for(int i : rest) {
        cnt[big_root] = a[big_root] - a[i];
        ans[big_root].push_back(i);
        big_root = i;
    }
    cnt[rest.back()] = a[rest.back()];

    for(int i = 0; i < n; i++) {
        cout << cnt[i] << ' ' << ans[i].size() << ' ';
        for(int x : ans[i]) cout << x + 1 << ' ';
        cout << '\n';
    }
}


///In the name of GOD
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
const ll MXN = 7e4 + 10;
ll n, s, maxi, id, lst, p;
ll A[MXN], par[MXN], ANS[MXN];
bitset<MXN> mark, last, vis;
vector<ll> vec, Ans[MXN];
vector<pair<ll, ll>> vec2;
int main(){
    ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
    cin >> n >> s;
    for(int i = 1; i <= n; i ++){
        cin >> A[i];
        if(A[i] > maxi) maxi = A[i], id = i;
    }
    if(maxi > s) return cout << -1, 0;
    s -= maxi, mark[0] = 1, p = s;
    for(int i = 1; i <= n; i ++){
        if(i == id) continue;
        last = mark;
        mark = mark | (mark << A[i]);
        last = last ^ mark;
        for(int b = last._Find_first(); b < last.size(); b = last._Find_next(b)){
            par[b] = i;
        }
    }
    if(!mark[s]) return cout << -1, 0;
    while(p > 0){
        vec.push_back(A[par[p]]);
        vis[par[p]] = 1, ANS[par[p]] = A[par[p]], p -= A[par[p]];
    }
    for(int i = 1; i <= n; i ++){
        if(vis[i]) continue;
        vec2.emplace_back(A[i], i);
    }
    sort(vec2.begin(), vec2.end());
    lst = vec2[0].first, ANS[vec2[0].second] = A[vec2[0].second];
    for(int i = 1; i < vec2.size(); i ++){
        ANS[vec2[i].second] = vec2[i].first - lst, lst = vec2[i].first;
        Ans[vec2[i].second].push_back(vec2[i - 1].second);
    }
    for(int i = 1; i <= n; i ++){
        cout << ANS[i] << ' ' << Ans[i].size() << ' ';
        for(auto X : Ans[i]) cout << X << ' '; cout << '\n';
    }
    return 0;
}
/*!
    You are under no obligation to be the same person you were a minute ago,
    You have the right to grow !
*/
//! N.N


///A drunk man will find his way home, but a drunk bird may get lost forever...
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define f first
#define s second
#define int long long
#define sz(x) (int)x.size()
const int mx = 70005;
bitset < mx > dp, x;
pair < int , int > a[mx];
int par[mx], ans[mx];
vector < int > vec[mx];
bool mark[mx];
int32_t main(){
	ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	int n, s;
	cin >> n >> s;
	for(int i = 0; i < n; i++){
		cin >> a[i].f;
		a[i].s = i;
	}
	sort(a , a + n, greater < pair < int , int > >());
	s -= a[0].f;
	if(s < 0){
		cout << -1 << endl;
		return 0;
	}
	dp[0] = 1;
	for(int i = 1; i < n; i++){
		x = (((dp << a[i].f) | dp) ^ dp);
		dp = ((dp << a[i].f) | dp);
		for(int j = x._Find_first(); j < sz(x); j = x._Find_next(j)){
				par[j] = i;
			//	cout << j << endl;
		}
	}
	if(!dp[s]){
		cout << -1 << endl;
		return 0;
	}
	int ps = s;
	while(ps > 0){
		mark[par[ps]] = true;
	//	cout << par[ps] << endl;
		ps -= a[par[ps]].f;
	//	cout << ps << endl;
	}
	mark[0] = true;
	for (int i = 0; i < n; i++){
		ans[a[i].s] = a[i].f;
		if (!mark[i]){
			vec[a[i - 1].s].pb(a[i].s);
			ans[a[i - 1].s] -= a[i].f;
		}
	}
	for (int i = 0; i < n; i ++){
		cout << ans[i] << " " << sz(vec[i]) << " ";
		for (int j = 0; j < sz(vec[i]); j++)
			cout << vec[i][j] + 1 << " ";
		cout << "\n";
	}
	return 0;
}


#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

#pragma GCC optimize("-O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

#define fi first
#define se second
#define p_b push_back
#define pll pair<ll,ll>
#define pii pair<int,int>
#define m_p make_pair
#define all(x) x.begin(),x.end()
#define sset ordered_set
#define sqr(x) (x)*(x)
#define pw(x) (1ll << x)

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
const ll MAXN = 1123456;
const ll N = (int)7e4 + 1;
const ll inf = 3e18;
mt19937_64 rnd(chrono::system_clock::now().time_since_epoch().count());

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

template <typename T> void vout(T s){cout << s << endl;exit(0);}

ll Ft[MAXN];

bitset <N> a, b, c;

ll val[MAXN];

vector <ll> ans[MAXN];

int main(){
    ios_base :: sync_with_stdio(0);
    cin.tie(0);

    ll n, s;
    cin >> n >> s;
    vector <ll> arr(n + 1);
    vector <bool> us(n + 1);

    for(int i = 1; i <= n; i++)cin >> arr[i];

    ll pos = max_element(arr.begin() + 1, arr.end()) - arr.begin();
    s -= arr[pos];

    if(s < 0)vout(-1);
    a[0] = 1;

    us[pos] = 1;

    for(int i = 1; i <= n; i++)if(i != pos){
        b = (a << arr[i]) | a;
        c = b ^ a;
        a = b;
        while(c.any()){
            ll t = c._Find_first();
            c[t] = 0;
            Ft[t] = i;
        }
    }

    if(!a[s])vout(-1);

    vector <pll> ats;

    ll x = s;
    while(x){
        us[Ft[x]] = 1;
        x -= arr[Ft[x]];
    }

    for(int i = 1; i <= n; i++)if(i != pos){
        if(us[i])val[i] = arr[i];
        else{
            ats.p_b({arr[i], i});
        }
    }

    sort(ats.begin(), ats.end());

    ll last = 0, what = 0;

    for(auto i : ats){
        val[i.se] = i.fi - last;
        last = i.fi;
        if(what)ans[i.se].p_b(what);
        what = i.se;
    }

    if(what)ans[pos].p_b(what);
    val[pos] = arr[pos] - last;

    for(int i = 1; i <= n; i++){
        cout << val[i] << " " << ans[i].size();
        for(auto j : ans[i])cout << " " << j;
        cout << "\n";
    }

    return 0;
}


#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back

using namespace std;

typedef long long ll;
typedef string str;
typedef pair<ll, ll> pll;

const ll N = 7e4 + 10;
const ll MOD = 1e9 + 7;

bitset<N> knapsack, knapsack2, mark;
int n, s, par[N], b[N], IN[N];
pair<int, int> a[N];

int main(){
	cin >> n >> s;
	for (int i = 1; i <= n; i++){
		int v;
		cin >> v;
		a[i] = {v, i};
		b[i] = v;
	}
	sort(a + 1, a + n + 1);

	if (s < a[n].F) return cout << -1, 0;

	knapsack[0] = 1;
	for (int i = 1; i < n; i++){
		knapsack2 = knapsack | (knapsack << a[i].F);
		knapsack2 = knapsack ^ knapsack2;
		knapsack = knapsack | (knapsack << a[i].F);
		for (int j = knapsack2._Find_first(); j < N; j = knapsack2._Find_next(j)){
			par[j] = i;
		}
	}

	if (knapsack[s - a[n].F] == 0) return cout << -1, 0;
	ll x = s - a[n].F;
	vector<int> kho;

	while (x != 0){
		mark[a[par[x]].S] = 1;
		x -= a[par[x]].F;
	}
	ll past = 0;

	for (int i = 1; i < n; i++){
		if (!mark[a[i].S]){
			if (past != 0) IN[a[i].S] = past;
			past = a[i].S;
		}
	}

	IN[a[n].S] = past;

	for (int i = 1; i <= n; i++){
		if (IN[i] == 0) cout << b[i] << ' ' << 0 << '\n';
		else cout << b[i] - b[IN[i]] << ' ' << 1 << ' ' << IN[i] << '\n';
	}

	return 0;
}


// in the name of Allah

#include<bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define MP make_pair
#define pii pair<int, int>
#define p push_back
#define pll pair<ll, ll>
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define REP(i,n) FOR(i,0,n)
#define FBT(i, msk)for(int i=__builtin_ctz(msk),tmp=msk;tmp;tmp&=tmp-1,i=__builtin_ctz(tmp))
using namespace std;

const int MX = 7e4+5, MXX=7e4+5;
const ll mod=1e9+7, inf=1e18+6;
int a[MXX], s[MXX], sz[MXX], in[MXX];
bitset<MX> dp[MX];

int main()
{
   ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
   cout<<fixed<<setprecision(9);
	memset(in, -1, sizeof in);
	int n, k;
	cin>>n>>k;

	REP(i, n)
		cin>>a[i], s[i] = i;

	sort(s, s + n, [](int i, int j){ return a[i] < a[j]; });

	int t = k - a[s[n - 1]] + 1;
	if(t <= 0)
		return cout<<"-1\n", 0;

	dp[n - 1][0] = 1;
	for(int i = n - 2;i >= 0;i--)
		dp[i] = dp[i + 1] | (dp[i + 1] << a[s[i]]);

	if(!dp[0][t - 1])
		return cout<<"-1\n", 0;

	vector<int> vc;
	int ls = t - 1;
	REP(i, n - 1)
	{
		if(ls && dp[i + 1][ls - a[s[i]]])
			sz[s[i]] = a[s[i]], ls -= a[s[i]];
		else
			vc.p(s[i]);
	}
	vc.p(s[n - 1]);

	sz[vc[0]] = a[vc[0]];
	FOR(i, 1, vc.size())
		sz[vc[i]] = a[vc[i]] - a[vc[i - 1]], in[vc[i]] = vc[i - 1];

	REP(i, n)
	{
		cout<<sz[i]<<' ';
		if(in[i] == -1)
			cout<<"0\n";
		else
			cout<<"1 "<<in[i] + 1<<"\n";
	}
	return 0;
}


// in the name of Allah

#include<bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define MP make_pair
#define pii pair<int, int>
#define p push_back
#define pll pair<ll, ll>
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define REP(i,n) FOR(i,0,n)
#define FBT(i, msk)for(int i=__builtin_ctz(msk),tmp=msk;tmp;tmp&=tmp-1,i=__builtin_ctz(tmp))
using namespace std;

const int MX = 7e4+5, MXX=7e4+5;
const ll mod=1e9+7, inf=1e18+6;
int a[MXX], s[MXX], sz[MXX], in[MXX], ls[MXX];
bitset<MX> dp, ex, tmp;

int main()
{
   ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
   cout<<fixed<<setprecision(9);
	memset(in, -1, sizeof in);
	int n, k;
	cin>>n>>k;

	REP(i, n)
		cin>>a[i], s[i] = i;

	sort(s, s + n, [](int i, int j){ return a[i] < a[j]; });

	int t = k - a[s[n - 1]] + 1;
	if(t <= 0)
		return cout<<"-1\n", 0;

	dp[0] = 1;
	ex[0] = 1;
	ls[0] = -1;
	for(int i = n - 2;i >= 0;i--)
	{
		dp |= (dp << a[s[i]]);
		tmp = dp ^ ex;

		for(int j = tmp._Find_first();j < t;j = tmp._Find_next(j))
		{
			ls[j] = s[i];
			ex[j] = 1;
		}
	}

	if(!ex[t - 1])
		return cout<<"-1\n", 0;

	vector<int> vc;
	int en = t - 1;
	REP(i, n - 1)
	{
		if(ls[en] == s[i])
			sz[s[i]] = a[s[i]], en -= a[s[i]];
		else
			vc.p(s[i]);
	}
	vc.p(s[n - 1]);

	sz[vc[0]] = a[vc[0]];
	FOR(i, 1, vc.size())
		sz[vc[i]] = a[vc[i]] - a[vc[i - 1]], in[vc[i]] = vc[i - 1];

	REP(i, n)
	{
		cout<<sz[i]<<' ';
		if(in[i] == -1)
			cout<<"0\n";
		else
			cout<<"1 "<<in[i] + 1<<"\n";
	}
	return 0;
}


#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
using namespace std;
typedef long long ll;
const int S = 7, maxn = 70005;
bitset<maxn> dp[maxn/S+S];
int vis[maxn];
int n, s;
int p;
int a[maxn];
bool judge() {
	dp[0][0]=1;
	int i;
	for(i=0; i*S<n; i++) {
		std::bitset<maxn> &cur = dp[i + 1] = dp[i];
		for(int j=0, k; j<S &&(k=i*S+j)<n; j++) {
			if(j!=p)
				cur |= cur<<a[k];
		}
	}
	int tot = s-a[p];
	if (!dp[i][tot]) return false;
	while(--i>=0) {
		for(int j=0; j<(1<<S); j++) {
			int sum = 0;
			int ok=1;
			for(int k=0, kk; k<S && (kk=i*S+k)<n; k++) {

				if(j>>k&1) {
					if(kk==p) {
						ok=0;
						break;
					}
					sum += a[kk];
				}
			}
			if(!ok) continue;
			if(tot>=sum && dp[i][tot-sum]) {
				for(int k=0,kk; k<S && (kk=i*S+k)<n; k++) {
					if(j>>k&1) {
						vis[kk]=1;

					}
				}
				tot-=sum;
				break;
			}
		}
	}
	return true;
}
inline int read() {
	int x = 0, f = 1;
	char ch = getchar();
	while (ch < '0' || ch > '9') {
		if (ch == '-') f = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9') {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	return x * f;
}
inline ll read1() {
	ll x = 0, f = 1;
	char ch = getchar();
	while (ch < '0' || ch > '9') {
		if (ch == '-') f = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9') {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	return x * f;
}
vector<int> ans, V[maxn];
int out[maxn];
bool cmp(int x, int y) {
	return a[x]<a[y];
}
signed main() {
	cin >> n >> s;
	for(int i=0; i<n; i++) {
		scanf("%d", &a[i]);
	}
	p = max_element(a, a + n) - a;
	if(a[p]>s) {
		printf("-1\n");
		return 0;
	}
	vis[p]=1;
	if(!judge()) {
		printf("-1\n");
		return 0;
	}

	for(int i=0; i<n; i++) {
		if(!vis[i]) ans.push_back(i);
		else out[i] = a[i];
	}
	sort(ans.begin(), ans.end(), cmp);
	ans.push_back(p);
	for (int i = 0; i < ans.size(); ++i) {
		int x = ans[i];
		out[x] = a[x];
		if (i) V[x].push_back(ans[i - 1]), out[x] -= a[ans[i - 1]];
	}

//	cout << accumulate(out, out + n, 0LL) << '\n';
//	if (accumulate(out, out + n, 0LL) != s) return puts("-1"), 0;
	for (int i = 0; i < n; ++i) {
		printf("%d %d", out[i], V[i].size());
		for (int j = 0; j < V[i].size(); ++j) printf(" %d", V[i][j] + 1);
		putchar('\n');
	}

}


#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
using namespace std;
typedef long long ll;
const int S = 7, maxn = 70005;
bitset<maxn> dp[maxn/S+S];
int vis[maxn];
int n, s;
int p;
int a[maxn];
bool judge() {
	dp[0][0]=1;
	int i;
	for(i=0; i*S<n; ++i) {
		std::bitset<maxn> &cur = dp[i + 1] = dp[i];
		for(int j=0, k; j<S &&(k=i*S+j)<n; j++) {
			if(j!=p)
				cur |= cur<<a[k];
		}
	}
	int tot = s-a[p];
	if (!dp[i][tot]) return false;
	while(--i>=0) {
		for(int j=0; j<(1<<S); j++) {
			int sum = 0;
			int ok=1;
			for(int k=0, kk; k<S && (kk=i*S+k)<n; k++) {

				if(j>>k&1) {
					if(kk==p) {
						ok=0;
						break;
					}
					sum += a[kk];
				}
			}
			if(!ok) continue;
			if(tot>=sum && dp[i][tot-sum]) {
				for(int k=0,kk; k<S && (kk=i*S+k)<n; k++) {
					if(j>>k&1) {
						vis[kk]=1;

					}
				}
				tot-=sum;
				break;
			}
		}
	}
	return true;
}
inline int read() {
	int x = 0, f = 1;
	char ch = getchar();
	while (ch < '0' || ch > '9') {
		if (ch == '-') f = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9') {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	return x * f;
}
inline ll read1() {
	ll x = 0, f = 1;
	char ch = getchar();
	while (ch < '0' || ch > '9') {
		if (ch == '-') f = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9') {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	return x * f;
}
vector<int> ans, V[maxn];
int out[maxn];
bool cmp(int x, int y) {
	return a[x]<a[y];
}
signed main() {
	cin >> n >> s;
	for(int i=0; i<n; i++) {
		scanf("%d", &a[i]);
	}
	p = max_element(a, a + n) - a;
	if(a[p]>s) {
		printf("-1\n");
		return 0;
	}
	vis[p]=1;
	if(!judge()) {
		if(n == 680) cout << "xxxxxxx";
		printf("-1\n");
		return 0;
	}

	for(int i=0; i<n; i++) {
		if(!vis[i]) ans.push_back(i);
		else out[i] = a[i];
	}
	sort(ans.begin(), ans.end(), cmp);
	ans.push_back(p);
	for (int i = 0; i < ans.size(); ++i) {
		int x = ans[i];
		out[x] = a[x];
		if (i) V[x].push_back(ans[i - 1]), out[x] -= a[ans[i - 1]];
	}

//	cout << accumulate(out, out + n, 0LL) << '\n';
//	if (accumulate(out, out + n, 0LL) != s) return puts("-1"), 0;
	for (int i = 0; i < n; ++i) {
		printf("%d %d", out[i], V[i].size());
		for (int j = 0; j < V[i].size(); ++j) printf(" %d", V[i][j] + 1);
		putchar('\n');
	}

}


#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
using namespace std;
typedef long long ll;
const int S = 7, maxn = 70005;
bitset<maxn> dp[maxn/S+S];
int vis[maxn];
int n, s;
int p;
int a[maxn];
bool judge() {
	dp[0][0]=1;
	int i;
	for(i=0; i*S<n; ++i) {
		std::bitset<maxn> &cur = dp[i + 1] = dp[i];
		for(int j=0, k; j<S &&(k=i*S+j)<n; j++) {
			if(j!=p)
				cur |= cur<<a[k];
		}
	}
	int tot = s-a[p];
	if(n == 680) cout << dp[i];
	if (!dp[i][tot]) return false;
	while(--i>=0) {
		for(int j=0; j<(1<<S); j++) {
			int sum = 0;
			int ok=1;
			for(int k=0, kk; k<S && (kk=i*S+k)<n; k++) {

				if(j>>k&1) {
					if(kk==p) {
						ok=0;
						break;
					}
					sum += a[kk];
				}
			}
			if(!ok) continue;
			if(tot>=sum && dp[i][tot-sum]) {
				for(int k=0,kk; k<S && (kk=i*S+k)<n; k++) {
					if(j>>k&1) {
						vis[kk]=1;

					}
				}
				tot-=sum;
				break;
			}
		}
	}
	return true;
}
inline int read() {
	int x = 0, f = 1;
	char ch = getchar();
	while (ch < '0' || ch > '9') {
		if (ch == '-') f = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9') {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	return x * f;
}
inline ll read1() {
	ll x = 0, f = 1;
	char ch = getchar();
	while (ch < '0' || ch > '9') {
		if (ch == '-') f = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9') {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	return x * f;
}
vector<int> ans, V[maxn];
int out[maxn];
bool cmp(int x, int y) {
	return a[x]<a[y];
}
signed main() {
	cin >> n >> s;
	for(int i=0; i<n; i++) {
		scanf("%d", &a[i]);
	}
	p = max_element(a, a + n) - a;
	if(a[p]>s) {
		printf("-1\n");
		return 0;
	}
	vis[p]=1;
	if(!judge()) {

		printf("-1\n");
		return 0;
	}

	for(int i=0; i<n; i++) {
		if(!vis[i]) ans.push_back(i);
		else out[i] = a[i];
	}
	sort(ans.begin(), ans.end(), cmp);
	ans.push_back(p);
	for (int i = 0; i < ans.size(); ++i) {
		int x = ans[i];
		out[x] = a[x];
		if (i) V[x].push_back(ans[i - 1]), out[x] -= a[ans[i - 1]];
	}

//	cout << accumulate(out, out + n, 0LL) << '\n';
//	if (accumulate(out, out + n, 0LL) != s) return puts("-1"), 0;
	for (int i = 0; i < n; ++i) {
		printf("%d %d", out[i], V[i].size());
		for (int j = 0; j < V[i].size(); ++j) printf(" %d", V[i][j] + 1);
		putchar('\n');
	}

}


#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
using namespace std;
typedef long long ll;
const int S = 7, maxn = 70005;
bitset<maxn> dp[maxn/S+S];
int vis[maxn];
int n, s;
int p;
int a[maxn];
bool judge() {
	dp[0][0] = 1;
	int i;
	for (i = 0; S * i < n; ++i) {
		std::bitset<maxn> &cur = dp[i + 1] = dp[i];
		for (int j = 0, k; j < S && (k = S * i + j) < n; ++j) if (k != p) cur |= cur << a[k];
	}
	int tot = s - a[p];
	if (!dp[i][tot]) return false;
	while(--i>=0) {
		for(int j=0; j<(1<<S); j++) {
			int sum = 0;
			int ok=1;
			for(int k=0, kk; k<S && (kk=i*S+k)<n; k++) {

				if(j>>k&1) {
					if(kk==p) {
						ok=0;
						break;
					}
					sum += a[kk];
				}
			}
			if(!ok) continue;
			if(tot>=sum && dp[i][tot-sum]) {
				for(int k=0,kk; k<S && (kk=i*S+k)<n; k++) {
					if(j>>k&1) {
						vis[kk]=1;

					}
				}
				tot-=sum;
				break;
			}
		}
	}
	return true;
}
inline int read() {
	int x = 0, f = 1;
	char ch = getchar();
	while (ch < '0' || ch > '9') {
		if (ch == '-') f = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9') {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	return x * f;
}
inline ll read1() {
	ll x = 0, f = 1;
	char ch = getchar();
	while (ch < '0' || ch > '9') {
		if (ch == '-') f = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9') {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	return x * f;
}
vector<int> ans, V[maxn];
int out[maxn];
bool cmp(int x, int y) {
	return a[x]<a[y];
}
signed main() {
	cin >> n >> s;
	for(int i=0; i<n; i++) {
		scanf("%d", &a[i]);
	}
	p = max_element(a, a + n) - a;
	if(a[p]>s) {
		printf("-1\n");
		return 0;
	}
	vis[p]=1;
	if(!judge()) {

		printf("-1\n");
		return 0;
	}

	for(int i=0; i<n; i++) {
		if(!vis[i]) ans.push_back(i);
		else out[i] = a[i];
	}
	sort(ans.begin(), ans.end(), cmp);
	ans.push_back(p);
	for (int i = 0; i < ans.size(); ++i) {
		int x = ans[i];
		out[x] = a[x];
		if (i) V[x].push_back(ans[i - 1]), out[x] -= a[ans[i - 1]];
	}

//	cout << accumulate(out, out + n, 0LL) << '\n';
//	if (accumulate(out, out + n, 0LL) != s) return puts("-1"), 0;
	for (int i = 0; i < n; ++i) {
		printf("%d %d", out[i], V[i].size());
		for (int j = 0; j < V[i].size(); ++j) printf(" %d", V[i][j] + 1);
		putchar('\n');
	}

}


#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
using namespace std;
typedef long long ll;
const int S = 7, maxn = 70005;
bitset<maxn> dp[maxn/S+S];
int vis[maxn];
int n, s;
int p;
int a[maxn];
bool judge() {
	dp[0][0]=1;
	int i;
	for(i=0; i*S<n; i++) {
		std::bitset<maxn> &cur = dp[i + 1] = dp[i];
		for(int j=0, k; j<S &&(k=i*S+j)<n; j++) {
			if(j!=p)
				cur |= cur<<a[k];
		}
	}
	int tot = s-a[p];
	if (!dp[i][tot]) return false;
	while(--i>=0) {
		for(int j=0; j<(1<<S); j++) {
			int sum = 0;
			int ok=1;
			for(int k=0, kk; k<S && (kk=i*S+k)<n; k++) {

				if(j>>k&1) {
					if(kk==p) {
						ok=0;
						break;
					}
					sum += a[kk];
				}
			}
			if(!ok) continue;
			if(tot>=sum && dp[i][tot-sum]) {
				for(int k=0,kk; k<S && (kk=i*S+k)<n; k++) {
					if(j>>k&1) {
						vis[kk]=1;

					}
				}
				tot-=sum;
				break;
			}
		}
	}
	return true;
}
inline int read() {
	int x = 0, f = 1;
	char ch = getchar();
	while (ch < '0' || ch > '9') {
		if (ch == '-') f = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9') {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	return x * f;
}
inline ll read1() {
	ll x = 0, f = 1;
	char ch = getchar();
	while (ch < '0' || ch > '9') {
		if (ch == '-') f = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9') {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	return x * f;
}
vector<int> ans, V[maxn];
int out[maxn];
bool cmp(int x, int y) {
	return a[x]<a[y];
}
signed main() {
	cin >> n >> s;
	for(int i=0; i<n; i++) {
		scanf("%d", &a[i]);
	}
	p = max_element(a, a + n) - a;
	if(a[p]>s) {
		printf("-1\n");
		return 0;
	}
	vis[p]=1;
	if(!judge()) {
		printf("-1\n");
		return 0;
	}

	for(int i=0; i<n; i++) {
		if(!vis[i]) ans.push_back(i);
		else out[i] = a[i];
	}
	sort(ans.begin(), ans.end(), cmp);
	ans.push_back(p);
	for (int i = 0; i < ans.size(); ++i) {
		int x = ans[i];
		out[x] = a[x];
		if (i) V[x].push_back(ans[i - 1]), out[x] -= a[ans[i - 1]];
	}

//	cout << accumulate(out, out + n, 0LL) << '\n';
	if (accumulate(out, out + n, 0LL) != s) return puts("-1"), 0;
	for (int i = 0; i < n; ++i) {
		printf("%d %d", out[i], V[i].size());
		for (int j = 0; j < V[i].size(); ++j) printf(" %d", V[i][j] + 1);
		putchar('\n');
	}

}


#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
using namespace std;
typedef long long ll;
const int S = 7, maxn = 70005;
bitset<maxn> dp[maxn/S+S];
int vis[maxn];
int n, s;
int p;
int a[maxn];
bool judge() {
	dp[0][0]=1;
	int i;
	for(i=0; i*S<n; ++i) {
		std::bitset<maxn> &cur = dp[i + 1] = dp[i];
		for(int j=0, k; j<S &&(k=i*S+j)<n; j++) {
			if(j!=p)
				cur |= cur<<a[k];
		}
	}
	int tot = s-a[p];
	if (!dp[i][tot]) return false;
	while(--i>=0) {
		for(int j=0; j<(1<<S); j++) {
			int sum = 0;
			int ok=1;
			for(int k=0, kk; k<S && (kk=i*S+k)<n; k++) {

				if(j>>k&1) {
					if(kk==p) {
						ok=0;
						break;
					}
					sum += a[kk];
				}
			}
			if(!ok) continue;
			if(tot>=sum && dp[i][tot-sum]) {
				for(int k=0,kk; k<S && (kk=i*S+k)<n; k++) {
					if(j>>k&1) {
						vis[kk]=1;

					}
				}
				tot-=sum;
				break;
			}
		}
	}
	return true;
}
inline int read() {
	int x = 0, f = 1;
	char ch = getchar();
	while (ch < '0' || ch > '9') {
		if (ch == '-') f = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9') {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	return x * f;
}
inline ll read1() {
	ll x = 0, f = 1;
	char ch = getchar();
	while (ch < '0' || ch > '9') {
		if (ch == '-') f = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9') {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	return x * f;
}
vector<int> ans, V[maxn];
int out[maxn];
bool cmp(int x, int y) {
	return a[x]<a[y];
}
signed main() {
	cin >> n >> s;
	for(int i=0; i<n; i++) {
		scanf("%d", &a[i]);
	}
	p = max_element(a, a + n) - a;
	if(a[p]>s) {
		printf("-1\n");
		return 0;
	}
	vis[p]=1;
	if(!judge()) {
		printf("-1\n");
		return 0;
	}

	for(int i=0; i<n; i++) {
		if(!vis[i]) ans.push_back(i);
		else out[i] = a[i];
	}
	sort(ans.begin(), ans.end(), cmp);
	ans.push_back(p);
	for (int i = 0; i < ans.size(); ++i) {
		int x = ans[i];
		out[x] = a[x];
		if (i) V[x].push_back(ans[i - 1]), out[x] -= a[ans[i - 1]];
	}

//	cout << accumulate(out, out + n, 0LL) << '\n';
//	if (accumulate(out, out + n, 0LL) != s) return puts("-1"), 0;
	for (int i = 0; i < n; ++i) {
		printf("%d %d", out[i], V[i].size());
		for (int j = 0; j < V[i].size(); ++j) printf(" %d", V[i][j] + 1);
		putchar('\n');
	}

}


#include <cstdio>
#include <bitset>
#include <vector>
#include <numeric>
#include <algorithm>
#include<iostream>
const int N = 70000 + 10, S = 7;

int n, p, s, a[N];

bool flag[N];

inline bool comp(int x, int y) {
	return a[x] < a[y];
}

int c[N];
std::vector<int> adj[N];

std::bitset<N> f[N / S + S];

bool init() {
	f[0][0] = 1;
	int i;
	for (i = 0; S * i < n; ++i) {
		std::bitset<N> &cur = f[i + 1] = f[i];
		for (int j = 0, k; j < S && (k = S * i + j) < n; ++j) if (k != p) cur |= cur << a[k];
	}
	int t = s - a[p];
	if (!f[i][t]) return false;
	while (--i >= 0) {
		for (int mask = 0; mask < (1 << S); ++mask) {
			bool temp = true;
			int val = 0;
			for (int j = 0, k; j < S && (k = S * i + j) < n; ++j) {
				if (mask >> j & 1) {
					if (k == p) {
						temp = false;
						break;
					}
					val += a[k];
				}
			}
			if (temp && t >= val && f[i][t - val]) {
				t -= val;
				for (int j = 0, k; j < S && (k = S * i + j) < n; ++j) if (mask >> j & 1) flag[k] = true;
				break;
			}
		}
	}
	return true;
}

int main() {
	scanf("%d%d", &n, &s);
	for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
	p = std::max_element(a, a + n) - a;
	if (s < a[p]) return puts("-1"), 0;
	flag[p] = true;
	if (!init()) return puts("-1"), 0;
	std::vector<int> pool;
	for (int i = 0; i < n; ++i) if (!flag[i]) pool.push_back(i);
		else c[i] = a[i];
	std::sort(pool.begin(), pool.end(), comp);
	pool.push_back(p);
	for (int i = 0; i < pool.size(); ++i) {
		int x = pool[i];
		c[x] = a[x];
		if (i) adj[x].push_back(pool[i - 1]), c[x] -= a[pool[i - 1]];
	}
//	std::cout << std::accumulate(c, c + n, 0LL) << std::endl;
	if (std::accumulate(c, c + n, 0LL) != s) return puts("-1"), 0;
	for (int i = 0; i < n; ++i) {
		printf("%d %d", c[i], adj[i].size());
		for (int j = 0; j < adj[i].size(); ++j) printf(" %d", adj[i][j] + 1);
		putchar('\n');
	}
	return 0;
}


#include <bits/stdc++.h>
#define maxn 70005
#define INF 0x3f3f3f3f
#define int long long
using namespace std;
typedef long long ll;
const int S = 7;
bitset<maxn> dp[maxn/S+S];
int vis[maxn];
int n, s;
int p;
int a[maxn];
bool judge() {
	dp[0][0]=1;
	int i;
	for(i=0; i*S<n; i++) {
		dp[i+1] = dp[i];
		for(int j=0; j<S &&(i*S+j)<n; j++) {
			if(j!=p)
				dp[i+1] |= dp[i+1]<<a[i*S+j];
		}
	}
	int tot = s-a[p];
	if (!dp[i][tot]) return false;
	while(--i>=0) {
		for(int j=0; j<(1<<S); j++) {
			int sum = 0;
			int ok=1;
			for(int k=0; k<S && (i*S+k)<n; k++) {

				if(j>>k&1) {
					if(i*S+k==p) {
						ok=0;
						break;
					}
					sum += a[i*S+k];
				}
			}
			if(!ok) continue;
			if(tot>=sum && dp[i][tot-sum]) {
				for(int k=0; k<S && (i*S+k)<n; k++) {
					if(j>>k&1) {
						vis[i*S+k]=1;

					}
				}
				tot-=sum;
				break;
			}
		}
	}
	return true;
}
inline int read() {
	int x = 0, f = 1;
	char ch = getchar();
	while (ch < '0' || ch > '9') {
		if (ch == '-') f = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9') {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	return x * f;
}
inline ll read1() {
	ll x = 0, f = 1;
	char ch = getchar();
	while (ch < '0' || ch > '9') {
		if (ch == '-') f = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9') {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	return x * f;
}
vector<int> ans, V[maxn];
int out[maxn];
bool cmp(int x, int y) {
	return a[x]<a[y];
}
signed main() {
	cin >> n >> s;
	for(int i=0; i<n; i++) {
		a[i]=read();
	}
	p = max_element(a, a + n) - a;
	if(a[p]>s) {
		printf("-1\n");
		return 0;
	}
	vis[p]=1;
	if(!judge()) {
		printf("-1\n");
		return 0;
	}

	for(int i=0; i<n; i++) {
		if(!vis[i]) ans.push_back(i);
		else out[i] = a[i];
	}
	sort(ans.begin(), ans.end(), cmp);
	ans.push_back(p);
	for (int i = 0; i < ans.size(); ++i) {
		int x = ans[i];
		out[x] = a[x];
		if (i) V[x].push_back(ans[i - 1]), out[x] -= a[ans[i - 1]];
	}

//	cout << accumulate(out, out + n, 0LL) << '\n';
	if (accumulate(out, out + n, 0LL) != s) return puts("-1"), 0;
	for (int i = 0; i < n; ++i) {
		printf("%lld %lld", out[i], V[i].size());
		for (int j = 0; j < V[i].size(); ++j) printf(" %lld", V[i][j] + 1);
		putchar('\n');
	}

}


#include <bits/stdc++.h>

#define ft first
#define sd second

using namespace std;

typedef pair<int, int> pii;

const int MAXN = 70 * 1000 + 123;

bitset<MAXN> dp[2], tmp;
int par[MAXN], n, s;
pii a[MAXN];
stringstream t[MAXN];

void inp();

int main() {
    inp();
    dp[1][0] = 1;
    for (int i = 0; i < n - 1; i++) {
        dp[i & 1] = dp[!(i & 1)] | (dp[!(i & 1)] << a[i].ft);
        tmp = dp[i & 1] ^ dp[!(i & 1)];
        for (int j = tmp._Find_first(); j < tmp.size(); j = tmp._Find_next(j))
            par[j] = i;
    }
    if (s - a[n - 1].ft >= 0 && dp[n & 1][s - a[n - 1].ft]) {
        bool mark[MAXN] = {};
        int chi = s - a[n - 1].ft, mex = n - 1;
        while (chi) {
            mark[par[chi]] = true;
            chi -= a[par[chi]].ft;
        }
        for (int i = 0; i < n; i++)
            if (!mark[i]) {
                mex = i;
                break;
            }
        t[a[mex].sd] << a[mex].ft << " 0\n";
        int lst = mex;
        for (int i = mex + 1; i < n; i++)
            if (!mark[i])
                t[a[i].sd] << a[i].ft - a[lst].ft << ' ' << 1 << ' ' << a[lst].sd + 1 << '\n', lst = i;
        for (int i = 0; i < n - 1; i++)
            if (mark[i])
                t[a[i].sd] << a[i].ft << " 0\n";
        for (int i = 0; i < n; i++)
            cout << t[i].str();
    }
    else
        cout << "-1";
    return 0;
}
void inp() {
    cin >> n >> s;
    for (int i = 0; i < n; i++)
        cin >> a[i].ft, a[i].sd = i;
    sort(a, a + n);
}


#include <bits/stdc++.h>

#define ft first
#define sd second

using namespace std;

typedef pair<int, int> pii;

const int MAXN = 70 * 1000 + 123;

bitset<MAXN> dp[2], tmp;
int par[MAXN], n, s;
pii a[MAXN];
stringstream t[MAXN];

void inp();

int main() {
    inp();
    dp[1] = 1;
    for (int i = 0; i < n - 1; i++) {
        dp[i & 1] = dp[!(i & 1)] | (dp[!(i & 1)] << a[i].ft);
        tmp = dp[i & 1] ^ dp[!(i & 1)];
        for (int j = tmp._Find_first(); j < tmp.size(); j = tmp._Find_next(j))
            par[j] = i;
    }
    if (s - a[n - 1].ft >= 0 && dp[!(n & 1)][s - a[n - 1].ft]) {
        bool mark[MAXN] = {};
        int chi = s - a[n - 1].ft, mex = n - 1;
        while (chi) {
            mark[par[chi]] = true;
            chi -= a[par[chi]].ft;
        }
        for (int i = 0; i < n; i++)
            if (!mark[i]) {
                mex = i;
                break;
            }
        t[a[mex].sd] << a[mex].ft << " 0\n";
        int lst = mex;
        for (int i = mex + 1; i < n; i++)
            if (!mark[i])
                t[a[i].sd] << a[i].ft - a[lst].ft << ' ' << 1 << ' ' << a[lst].sd + 1 << '\n', lst = i;
        for (int i = 0; i < n - 1; i++)
            if (mark[i])
                t[a[i].sd] << a[i].ft << " 0\n";
        for (int i = 0; i < n; i++)
            cout << t[i].str();
    }
    else
        cout << "-1";
    return 0;
}
void inp() {
    cin >> n >> s;
    for (int i = 0; i < n; i++)
        cin >> a[i].ft, a[i].sd = i;
    sort(a, a + n);
}


#include <bits/stdc++.h>

#define ft first
#define sd second

using namespace std;

typedef pair<int, int> pii;

const int MAXN = 70 * 1000 + 123;

bitset<MAXN> dp[2], tmp;
int par[MAXN], n, s;
pii a[MAXN];
stringstream t[MAXN];

void inp();

int main() {
    inp();
    dp[1] = 1;
    for (int i = 0; i < n; i++) {
        dp[i & 1] = dp[!(i & 1)] | (dp[!(i & 1)] << a[i].ft);
        tmp = dp[i & 1] ^ dp[!(i & 1)];
        for (int j = tmp._Find_first(); j < tmp.size(); j = tmp._Find_next(j))
            par[j] = i;
    }
    if (dp[!(n & 1)][s]) {
        bool mark[MAXN] = {};
        int chi = s, mex = n - 1;
        while (chi) {
            mark[par[chi]] = true;
            chi -= a[par[chi]].ft;
        }
        for (int i = 0; i < n; i++)
            if (!mark[i]) {
                mex = i;
                break;
            }
        t[a[mex].sd] << a[mex].ft << " 0\n";
        int lst = mex;
        for (int i = 0; i < n; i++)
            cout << mark[i] << ' ';
        cout << endl;
        for (int i = mex + 1; i < n; i++)
            if (!mark[i] || i == n - 1)
                t[a[i].sd] << a[i].ft - a[lst].ft << ' ' << 1 << ' ' << a[lst].sd + 1 << '\n', lst = i;
        for (int i = 0; i < n - 1; i++)
            if (mark[i])
                t[a[i].sd] << a[i].ft << " 0\n";
        for (int i = 0; i < n; i++)
            cout << t[i].str();
    }
    else
        cout << "-1";
    return 0;
}
void inp() {
    cin >> n >> s;
    for (int i = 0; i < n; i++)
        cin >> a[i].ft, a[i].sd = i;
    sort(a, a + n);
}


#include <bits/stdc++.h>

#define ft first
#define sd second

using namespace std;

typedef pair<int, int> pii;

const int MAXN = 70 * 1000 + 123;

bitset<MAXN> dp[2], tmp;
int par[MAXN], n, s;
pii a[MAXN];
stringstream t[MAXN];

void inp();

int main() {
    inp();
    dp[1] = 1;
    for (int i = 0; i < n; i++) {
        dp[i & 1] = dp[!(i & 1)] | (dp[!(i & 1)] << a[i].ft);
        tmp = dp[i & 1] ^ dp[!(i & 1)];
        for (int j = tmp._Find_first(); j < tmp.size(); j = tmp._Find_next(j))
            par[j] = i;
    }
    if (dp[!(n & 1)][s]) {
        bool mark[MAXN] = {};
        int chi = s, mex = n - 1;
        while (chi) {
            mark[par[chi]] = true;
            chi -= a[par[chi]].ft;
        }
        for (int i = 0; i < n; i++)
            if (!mark[i]) {
                mex = i;
                break;
            }
        t[a[mex].sd] << a[mex].ft << " 0\n";
        int lst = mex;
        for (int i = mex + 1; i < n; i++)
            if (!mark[i] || i == n - 1)
                t[a[i].sd] << a[i].ft - a[lst].ft << ' ' << 1 << ' ' << a[lst].sd + 1 << '\n', lst = i;
        for (int i = 0; i < n - 1; i++)
            if (mark[i])
                t[a[i].sd] << a[i].ft << " 0\n";
        for (int i = 0; i < n; i++)
            cout << t[i].str();
    }
    else
        cout << "-1";
    return 0;
}
void inp() {
    cin >> n >> s;
    for (int i = 0; i < n; i++)
        cin >> a[i].ft, a[i].sd = i;
    sort(a, a + n);
}


#include <bits/stdc++.h>
using namespace std;

#define N 70070

int n, a[N], id[N], did[N], prv[N], gas[N], s;

bool cmp(int i, int j) {
	return a[i] < a[j];
}

int vis[N], ans[N], e;

bool dfs(int x, int k) {
    if (!x) return 1;
	if (vis[x] >= k) return 0;
	vis[x] = max(vis[x], k);
    for (int i = k; i >= 1; i --) if (x >= a[i]) {
        if (dfs(x - a[i], i - 1)) {
			ans[++e] = i;
			return 1;
        }
    }
    return 0;
}

int main() {
	scanf("%d %d", &n, &s);
	for (int i = 1; i <= n; i ++) {
		scanf("%d", &a[i]);
		id[i] = i;
	}
	sort (id + 1, id + n + 1, cmp);
	sort (a + 1, a + n + 1);
	for (int i = 1; i <= n; i ++) did[id[i]] = i;
	if (s >= a[n] && dfs(s - a[n], n - 1)) {
		memset(vis, 0, sizeof vis);
		for (int i = 1; i <= e; i ++) vis[ans[i]] = 1;
		vis[0] = 1;
		for (int i = 1; i <= n; i ++) {
            if (vis[i-1]) prv[i] = 0, gas[i] = 0;
            else prv[i] = i - 1, gas[i] = 1;
		}
		for (int i = 1; i <= n; i ++) {
			int now = did[i];
			printf("%d %d", a[now] - a[prv[now]], gas[now]);
			now = prv[now];
			if (now) printf(" %d", id[now]);
			puts("");
		}
	}
	else puts("-1");
	return 0;
}


//In The Name of Allah
#include <bits/stdc++.h>

using namespace std;

const int N = 7e4 + 10;

int a[N], id[N], use[N], c[N];
bitset < N > dp[2];

bool cmp(int i, int j){
    return a[j] < a[i];
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n, s;
    cin >> n >> s;
    for (int i = 1; i <= n; i ++)
        cin >> a[i], id[i] = i;
    sort(id + 1, id + n + 1, cmp);
    dp[1][a[id[1]]] = 1;
    for (int i = 2; i <= n; i ++)
        dp[i % 2] = (dp[(i - 1) % 2] << a[id[i]]) | dp[(i - 1) % 2];
    if (!dp[n % 2][s])
        return cout << -1, 0;
    for (int i = 1; i <= n; i ++)
        if (dp[n % 2][s - a[id[i]]])
            use[id[i]] = 1, s -= a[id[i]];
    int last = id[1];
    for (int i = 2; i <= n; i ++){
        if (use[id[i]])
            continue;
        c[last] = id[i];
        last = id[i];
    }
    for (int i = 1; i <= n; i ++){
        if (c[i])
            cout << a[i] - a[c[i]] << ' ' << 1 << ' ' << c[i] << '\n';
        else
            cout << a[i] << ' ' << 0 << '\n';
    }
    return 0;
}


//In The Name of Allah
#include <bits/stdc++.h>

using namespace std;

const int N = 7e4 + 10;

int a[N], id[N], use[N], c[N];
bitset < N > dp[N];

bool cmp(int i, int j){
    return a[j] < a[i];
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n, s;
    cin >> n >> s;
    for (int i = 1; i <= n; i ++)
        cin >> a[i], id[i] = i;
    sort(id + 1, id + n + 1, cmp);
    dp[1][a[id[1]]] = 1;
    for (int i = 2; i <= n; i ++)
        dp[i] = (dp[i - 1] << a[id[i]]) | dp[i - 1];
    if (!dp[n][s])
        return cout << -1, 0;
    for (int i = n; i >= 1; i --)
        if (!dp[i - 1][s])
            use[id[i]] = 1, s -= a[id[i]];
    int last = id[1];
    for (int i = 2; i <= n; i ++){
        if (use[id[i]])
            continue;
        c[last] = id[i];
        last = id[i];
    }
    for (int i = 1; i <= n; i ++){
        if (c[i])
            cout << a[i] - a[c[i]] << ' ' << 1 << ' ' << c[i] << '\n';
        else
            cout << a[i] << ' ' << 0 << '\n';
    }
    return 0;
}


//In The Name of Allah
#include <bits/stdc++.h>

using namespace std;

const int N = 7e4 + 10;

int a[N], id[N], use[N], c[N];
bitset < N > dp[2];

bool cmp(int i, int j){
    return a[j] < a[i];
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n, s;
    cin >> n >> s;
    for (int i = 1; i <= n; i ++)
        cin >> a[i], id[i] = i;
    sort(id + 1, id + n + 1, cmp);
    dp[1][a[id[1]]] = 1;
    for (int i = 2; i <= n; i ++)
        dp[i % 2] = (dp[(i - 1) % 2] << a[id[i]]) | dp[(i - 1) % 2];
    if (!dp[n % 2][s])
        return cout << -1, 0;
    for (int i = 1; i <= n; i ++)
        if (s && (dp[n % 2][s - a[id[i]]] || s == a[id[i]]))
            use[id[i]] = 1, s -= a[id[i]];
    int last = id[1];
    for (int i = 2; i <= n; i ++){
        if (use[id[i]])
            continue;
        c[last] = id[i];
        last = id[i];
    }
    for (int i = 1; i <= n; i ++){
        if (c[i])
            cout << a[i] - a[c[i]] << ' ' << 1 << ' ' << c[i] << '\n';
        else
            cout << a[i] << ' ' << 0 << '\n';
    }
    return 0;
}


//In The Name of Allah
#include <bits/stdc++.h>

using namespace std;

const int N = 7e4 + 10;

int a[N], id[N], use[N], c[N];
bitset < N > dp[2];

bool cmp(int i, int j){
    return a[j] < a[i];
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n, s;
    cin >> n >> s;
    for (int i = 1; i <= n; i ++)
        cin >> a[i], id[i] = i;
    sort(id + 1, id + n + 1, cmp);
    dp[1][a[id[1]]] = 1;
    for (int i = 2; i <= n; i ++)
        dp[i % 2] = (dp[(i - 1) % 2] << a[id[i]]) | dp[(i - 1) % 2];
    if (!dp[n % 2][s])
        return cout << -1, 0;
    for (int i = 1; i <= n; i ++)
        if (dp[n % 2][s - a[id[i]]] || s == a[id[i]])
            use[id[i]] = 1, s -= a[id[i]];
    int last = id[1];
    for (int i = 2; i <= n; i ++){
        if (use[id[i]])
            continue;
        c[last] = id[i];
        last = id[i];
    }
    for (int i = 1; i <= n; i ++){
        if (c[i])
            cout << a[i] - a[c[i]] << ' ' << 1 << ' ' << c[i] << '\n';
        else
            cout << a[i] << ' ' << 0 << '\n';
    }
    return 0;
}


//In The Name of Allah
#include <bits/stdc++.h>

using namespace std;

const int N = 7e4 + 10;

int a[N], id[N], use[N], c[N], par[N];
bitset < N > dp[2], bs;

bool cmp(int i, int j){
    return a[j] < a[i];
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n, s;
    cin >> n >> s;
    for (int i = 1; i <= n; i ++)
        cin >> a[i], id[i] = i;
    sort(id + 1, id + n + 1, cmp);
    dp[1][a[id[1]]] = 1;
    par[a[id[1]]] = id[1];
    for (int i = 2; i <= n; i ++){
        dp[i % 2] = (dp[(i - 1) % 2] << a[id[i]]) | dp[(i - 1) % 2];
        bs = dp[i % 2] ^ dp[(i - 1) % 2];
        for (int j = bs._Find_first(); j < bs.size(); j = bs._Find_next(j))
            par[j] = id[i];
    }
    if (!dp[n % 2][s])
        return cout << -1, 0;
    while (s)
        use[par[s]] = 1, s -= a[par[s]];
    int last = id[1];
    for (int i = 2; i <= n; i ++){
        if (use[id[i]])
            continue;
        c[last] = id[i];
        last = id[i];
    }
    for (int i = 1; i <= n; i ++){
        if (c[i])
            cout << a[i] - a[c[i]] << ' ' << 1 << ' ' << c[i] << '\n';
        else
            cout << a[i] << ' ' << 0 << '\n';
    }
    return 0;
}


//In The Name of Allah
#include <bits/stdc++.h>

using namespace std;

const int N = 7e4 + 10;

int a[N], id[N], use[N], c[N];
bitset < N > dp[2];

bool cmp(int i, int j){
    return a[j] < a[i];
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n, s;
    cin >> n >> s;
    for (int i = 1; i <= n; i ++)
        cin >> a[i], id[i] = i;
    sort(id + 1, id + n + 1, cmp);
    dp[1][a[id[1]]] = 1;
    for (int i = 2; i <= n; i ++)
        dp[i % 2] = (dp[(i - 1) % 2] << a[id[i]]) | dp[(i - 1) % 2];
    if (!dp[n % 2][s])
        return cout << -1, 0;
    for (int i = 1; i <= n; i ++)
        if (a[id[i]] <= s && (dp[(n - 1) % 2][s - a[id[i]]] || s == a[id[i]]))
            use[id[i]] = 1, s -= a[id[i]];
    int last = id[1];
    for (int i = 2; i <= n; i ++){
        if (use[id[i]])
            continue;
        c[last] = id[i];
        last = id[i];
    }
    for (int i = 1; i <= n; i ++){
        if (c[i])
            cout << a[i] - a[c[i]] << ' ' << 1 << ' ' << c[i] << '\n';
        else
            cout << a[i] << ' ' << 0 << '\n';
    }
    return 0;
}


//In The Name of Allah
#include <bits/stdc++.h>

using namespace std;

const int N = 7e4 + 10;

int a[N], id[N], use[N], c[N];
bitset < N > dp[2];

bool cmp(int i, int j){
    return a[j] < a[i];
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n, s;
    cin >> n >> s;
    for (int i = 1; i <= n; i ++)
        cin >> a[i], id[i] = i;
    sort(id + 1, id + n + 1, cmp);
    dp[1][a[id[1]]] = 1;
    for (int i = 2; i <= n; i ++)
        dp[i % 2] = (dp[(i - 1) % 2] << a[id[i]]) | dp[(i - 1) % 2];
    if (!dp[n % 2][s])
        return cout << -1, 0;
    for (int i = 1; i <= n; i ++)
        if (s && (dp[(n - 1) % 2][s - a[id[i]]] || s == a[id[i]]))
            use[id[i]] = 1, s -= a[id[i]];
    int last = id[1];
    for (int i = 2; i <= n; i ++){
        if (use[id[i]])
            continue;
        c[last] = id[i];
        last = id[i];
    }
    for (int i = 1; i <= n; i ++){
        if (c[i])
            cout << a[i] - a[c[i]] << ' ' << 1 << ' ' << c[i] << '\n';
        else
            cout << a[i] << ' ' << 0 << '\n';
    }
    return 0;
}


// Problem : D. Parcels
// Contest : Codeforces - Codeforces Round #274 (Div. 1)
// URL : https://codeforces.com/contest/480/problem/D
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

/*
 A Submission by $%U%$
 at time: $%Y%$-$%M%$-$%D%$ $%h%$:$%m%$:$%s%$
*/
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define fef(i,a,b) for(ll i=a;i<=b;i++)
#define rer(i,a,b) for(ll i=b;i>=a;i--)
#define wew while(true)
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define FILE_IN "cseq.inp"
#define FILE_OUT "cseq.out"
#define ofile freopen(FILE_IN,"r",stdin);freopen(FILE_OUT,"w",stdout)
#define fio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define nfio cin.tie(0);cout.tie(0)
#define max(x,y) (((x)>(y))?(x):(y))
#define min(x,y) (((x)<(y))?(x):(y))
#define ord(a,b,c) ((a>=b)and(b>=c))
#define MOD (ll(1000000007))
#define MAX 300001
#define mag 320
#define p1 first
#define p2 second.first
#define p3 second.second
#define fi first
#define se second
#define pow2(x) (ll(1)<<x)
#define pii pair<int,int>
#define piii pair<int,pii>
#define For(i,__,___) for(int i=__;i<=___;i++)
#define Rep(i,__,___) for(int i=__;i>=___;i--)
#define ordered_set tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update>
#define endl "\n"
#define bi BigInt
typedef long long ll;
//---------END-------//

const int N = (int)7e4 + 228;

int n, s, f[N];
bitset < N > pref, nxt, b;
pair < int, int > a[N];
vector < int > res[N];
bool was[N];

bool cmp(pair < int, int > a, pair < int, int > b)
{
	return a.second < b.second;
}

int main()
{
	scanf("%d%d", &n, &s);
	for (int i = 1; i <= n; i++)
		scanf("%d", &a[i].first), a[i].second = i;
	pref[0] = true;
	sort(a + 1, a + n + 1);
	for (int i = 1; i < n; i++)
	{
		nxt = (pref | (pref << a[i].first));
		b = (nxt ^ pref);
		for (int j = b._Find_first(); j <= s; j = b._Find_next(j))
		{
			f[j] = a[i].second;
		}
		pref = nxt;
	}
	if (a[n].first > s || !pref[s - a[n].first])
	{
		cout << -1 << endl;
		return 0;
	}
	s -= a[n].first;
	sort(a + 1, a + n + 1, &cmp);
	while(s > 0)
	{
		was[f[s]] = true;
		s -= a[f[s]].first;
	}
	sort(a + 1, a + n + 1);
	int last = -1;
	for (int i = 1; i <= n; i++)
	{
		if (!was[a[i].second])
		{
			if (last != -1)
				res[a[i].second].push_back(last);
			last = a[i].second;
		}
	}
	sort(a + 1, a + n + 1, &cmp);
	for (int i = 1; i <= n; i++)
	{
		if (res[i].empty())
			printf("%d", a[i].first);
		else
			printf("%d", a[i].first - a[res[i][0]].first);
		printf(" %d ", (int)res[i].size());
		for (int j = 0; j  < (int)res[i].size(); j++)
			printf("%d ", res[i][j]);
		printf("\n");
	}

	return 0;
}


#include <bits/stdc++.h>
using namespace std;

using pii = pair<int, int>;
using ll = long long;
using ld = long double;
using cd = complex<ld>;

constexpr int N = 80'000;

bitset<N + 1> dp;
int first[N + 1];
int a[N + 1];
int place[N + 1];
vector<int> g[N + 1];

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	int n, S;
	cin >> n >> S;
	vector<pii> b(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		b[i] = make_pair(a[i], i);
	}
	sort(b.rbegin(), b.rend());
	fill(first, first + S + 1, -1);

	dp[0] = true;
	bitset<N + 1> next = dp;
	for (int i = 0; i < n; i++) {
		next = dp | (dp << b[i].first);
		next ^= dp;
		for (size_t j = next._Find_first(); j <= N; j = next._Find_next(j)) {
			first[j] = b[i].second;
		}
		next ^= dp;
		dp = next;
	}

	if (!dp[S]) {
		cout << -1;
		return 0;
	}

	vector<int> roots;
	int maxRoot = -1;
	for (int i = S; i > 0; i -= a[first[i]]) {
		roots.push_back(first[i]);
		if (maxRoot == -1 || a[first[i]] > a[maxRoot]) {
			maxRoot = first[i];
		}
	}
	sort(roots.begin(), roots.end());

	vector<pii> left;
	for (int i = 0; i < n; i++) {
		place[i] = a[i];
		if (!binary_search(roots.begin(), roots.end(), i) || i == maxRoot) {
			left.emplace_back(a[i], i);
		}
	}
	sort(left.begin(), left.end());
	if (left.back().second != maxRoot) {
		cout << -1;
		return 0;
	}

	while (left.size() > 1) {
		auto[coins1, i] = left.back();
		left.pop_back();
		auto[coins2, j] = left.back();
		place[i] = coins1 - coins2;
		g[i].push_back(j);
	}

	for (int i = 0; i < n; i++) {
		cout << place[i] << " " << g[i].size() << " ";
		for (int j : g[i]) {
			cout << (j + 1) << " ";
		}
		cout << "\n";
	}

	return 0;
}


#include <bits/stdc++.h>
using namespace std;

using pii = pair<int, int>;
using ll = long long;
using ld = long double;
using cd = complex<ld>;

constexpr int N = 80'000;

bitset<N + 1> dp;
int first[N + 1];
int a[N + 1];
int place[N + 1];
vector<int> g[N + 1];

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	int n, S;
	cin >> n >> S;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	fill(first, first + S + 1, -1);

	dp[0] = true;
	bitset<N + 1> next = dp;
	for (int i = 0; i < n; i++) {
		next = dp | (dp << a[i]);
		next ^= dp;
		for (size_t j = next._Find_first(); j <= N; j = next._Find_next(j)) {
			first[j] = i;
		}
		next ^= dp;
		dp = next;
	}

	if (!dp[S]) {
		cout << -1;
		return 0;
	}

	vector<int> roots;
	int maxRoot = -1;
	for (int i = S; i > 0; i -= a[first[i]]) {
		roots.push_back(first[i]);
		if (maxRoot == -1 || a[first[i]] > a[maxRoot]) {
			maxRoot = first[i];
		}
	}
	reverse(roots.begin(), roots.end());

	vector<pii> left;
	for (int i = 0; i < n; i++) {
		place[i] = a[i];
		if (!binary_search(roots.begin(), roots.end(), i) || i == maxRoot) {
			left.emplace_back(a[i], i);
		}
	}
	sort(left.begin(), left.end());

	while (left.size() > 1) {
		auto[coins1, i] = left.back();
		left.pop_back();
		auto[coins2, j] = left.back();
		place[i] = coins1 - coins2;
		g[i].push_back(j);
	}

	for (int i = 0; i < n; i++) {
		cout << place[i] << " " << g[i].size() << " ";
		for (int j : g[i]) {
			cout << (j + 1) << " ";
		}
		cout << "\n";
	}

	return 0;
}


#include <bits/stdc++.h>
using namespace std;

using pii = pair<int, int>;
using ll = long long;
using ld = long double;
using cd = complex<ld>;

constexpr int N = 80'000;

bitset<N + 1> dp;
int first[N + 1];
int a[N + 1];
int place[N + 1];
vector<int> g[N + 1];

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	int n, S;
	cin >> n >> S;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	fill(first, first + S + 1, -1);

	dp[0] = true;
	bitset<N + 1> next = dp;
	for (int i = 0; i < n; i++) {
		next = dp | (dp << a[i]);
		next ^= dp;
		for (size_t j = next._Find_first(); j <= N; j = next._Find_next(j)) {
			first[j] = i;
		}
		next ^= dp;
		dp = next;
	}

	if (!dp[S]) {
		cout << -1;
		return 0;
	}

	vector<int> roots;
	int maxRoot = -1;
	for (int i = S; i > 0; i -= a[first[i]]) {
		roots.push_back(first[i]);
		if (maxRoot == -1 || a[first[i]] > a[maxRoot]) {
			maxRoot = first[i];
		}
	}
	sort(roots.begin(), roots.end());

	vector<pii> left;
	for (int i = 0; i < n; i++) {
		place[i] = a[i];
		if (!binary_search(roots.begin(), roots.end(), i) || i == maxRoot) {
			left.emplace_back(a[i], i);
		}
	}
	sort(left.begin(), left.end());
	if (left.back().second != maxRoot) {
		cout << -1;
		return 0;
	}

	while (left.size() > 1) {
		auto[coins1, i] = left.back();
		left.pop_back();
		auto[coins2, j] = left.back();
		place[i] = coins1 - coins2;
		g[i].push_back(j);
	}

	for (int i = 0; i < n; i++) {
		cout << place[i] << " " << g[i].size() << " ";
		for (int j : g[i]) {
			cout << (j + 1) << " ";
		}
		cout << "\n";
	}

	return 0;
}


#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define print(v,r) f(i,0,r) cout<<v[i]<<" "; cout<<endl;
#define Get(x,y) scanf("%I64d%I64d",&x,&y);
#define f_(i,a,b) for(int i=a;i>=b;i--)
#define Gett(x,y) scanf("%d%d",&x,&y);
#define f(i,a,b) for(int i=a;i<b;i++)
#define get(x) scanf("%I64d",&x);
#define gett(x) scanf("%d",&x);
#define ops(x) cout<<x<<" !"<<endl;
#define maxm(a,b) a=max(a,b);
#define minm(a,b) a=min(a,b);
#define bit(x) (1ll<<(x*1ll))
#define mp make_pair
#define ll long long
#define pb push_back
#define S second
#define F first

const int N=70009;

int n,s,u,sum,dp[N],par[N],mark[N];
pair<int,int> a[N];
vector<int> v1,v2,ans[N];

int main(){
	dp[0]=1;
	cin>>n>>s;
	f(i,0,n){ gett(a[i].F);a[i].S=i; }
	sort(a,a+n);
	s-=a[n-1].F;
	if(s<0) return cout<<-1,0;
	f(i,0,n-1){
		f_(j,min(s,sum+a[i].S),a[i].S){
			if(dp[j]==0 && dp[j-a[i].S]==1)
				dp[j]=1,par[j]=i;
		}
	}
	if(dp[s]==0) return cout<<-1,0;
	u=s;
	mark[n-1]=1;
	while(u){
		mark[par[u]]=1;
		u-=a[par[u]].F;
	}
	f(i,0,n){
		if(mark[i] && i!=n-1) v1.pb(i);
		else v2.pb(i);
	}
	f(i,0,v1.size())
		ans[a[v1[i]].S].pb(a[v1[i]].F),ans[a[v1[i]].S].pb(0);
	ans[a[v2[0]].S].pb(a[v2[0]].F),ans[a[v2[0]].S].pb(0);
	f(i,1,v2.size())
		ans[a[v2[i]].S].pb(a[v2[i]].F-a[v2[i-1]].F),ans[a[v2[i]].S].pb(1),ans[a[v2[i]].S].pb(a[v2[i-1]].S+1);
	f(i,0,n){
		f(j,0,ans[i].size())
			cout<<ans[i][j]<<" ";
		cout<<'\n';
	}
}


#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define print(v,r) f(i,0,r) cout<<v[i]<<" "; cout<<endl;
#define Get(x,y) scanf("%I64d%I64d",&x,&y);
#define f_(i,a,b) for(int i=a;i>=b;i--)
#define Gett(x,y) scanf("%d%d",&x,&y);
#define f(i,a,b) for(int i=a;i<b;i++)
#define get(x) scanf("%I64d",&x);
#define gett(x) scanf("%d",&x);
#define ops(x) cout<<x<<" !"<<endl;
#define maxm(a,b) a=max(a,b);
#define minm(a,b) a=min(a,b);
#define bit(x) (1ll<<(x*1ll))
#define mp make_pair
#define ll long long
#define pb push_back
#define S second
#define F first

const int N=70009;

int n,s,u,sum,dp[N],par[N],mark[N];
pair<int,int> a[N];
vector<int> v1,v2,ans[N];

int main(){
	dp[0]=1;
	cin>>n>>s;
	f(i,0,n){ gett(a[i].F);a[i].S=i; }
	sort(a,a+n);
	s-=a[n-1].F;
	if(s<0) return cout<<-1,0;
	f(i,0,n-1){
		f_(j,min(s,sum+a[i].F),a[i].F)
			if(dp[j]==0 && dp[j-a[i].F]==1)
				dp[j]=1,par[j]=i;
		if(dp[s]) break;
		sum+=a[i].F;
	}
	if(dp[s]==0) return cout<<-1,0;
	u=s;
	mark[n-1]=1;
	while(u){
		mark[par[u]]=1;
		u-=a[par[u]].F;
	}
	f(i,0,n){
		if(mark[i] && i!=n-1) v1.pb(i);
		else v2.pb(i);
	}
	f(i,0,v1.size())
		ans[a[v1[i]].S].pb(a[v1[i]].F),ans[a[v1[i]].S].pb(0);
	ans[a[v2[0]].S].pb(a[v2[0]].F),ans[a[v2[0]].S].pb(0);
	f(i,1,v2.size())
		ans[a[v2[i]].S].pb(a[v2[i]].F-a[v2[i-1]].F),ans[a[v2[i]].S].pb(1),ans[a[v2[i]].S].pb(a[v2[i-1]].S+1);
	f(i,0,n){
		f(j,0,ans[i].size())
			cout<<ans[i][j]<<" ";
		cout<<'\n';
	}
}


#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define print(v,r) f(i,0,r) cout<<v[i]<<" "; cout<<endl;
#define Get(x,y) scanf("%I64d%I64d",&x,&y);
#define f_(i,a,b) for(int i=a;i>=b;i--)
#define Gett(x,y) scanf("%d%d",&x,&y);
#define f(i,a,b) for(int i=a;i<b;i++)
#define get(x) scanf("%I64d",&x);
#define gett(x) scanf("%d",&x);
#define ops(x) cout<<x<<" !"<<endl;
#define maxm(a,b) a=max(a,b);
#define minm(a,b) a=min(a,b);
#define bit(x) (1ll<<(x*1ll))
#define mp make_pair
#define ll long long
#define pb push_back
#define S second
#define F first

const int N=70009;

int n,s,u,sum,dp[N],par[N],mark[N];
pair<int,int> a[N];
vector<int> v1,v2,ans[N];

int main(){
	f(i,0,N)
		f(j,0,N)
			n=1;
	ops(1);
	dp[0]=1;
	cin>>n>>s;
	f(i,0,n){ gett(a[i].F);a[i].S=i; }
	sort(a,a+n);
	s-=a[n-1].F;
	if(s<0) return cout<<-1,0;
	f(i,0,n-1){
		f_(j,min(s,sum+a[i].F),a[i].F)
			if(dp[j]==0 && dp[j-a[i].F]==1)
				dp[j]=1,par[j]=i;
		if(dp[s]) break;
		sum+=a[i].F;
	}
	if(dp[s]==0) return cout<<-1,0;
	u=s;
	mark[n-1]=1;
	while(u){
		mark[par[u]]=1;
		u-=a[par[u]].F;
	}
	f(i,0,n){
		if(mark[i] && i!=n-1) v1.pb(i);
		else v2.pb(i);
	}
	f(i,0,v1.size())
		ans[a[v1[i]].S].pb(a[v1[i]].F),ans[a[v1[i]].S].pb(0);
	ans[a[v2[0]].S].pb(a[v2[0]].F),ans[a[v2[0]].S].pb(0);
	f(i,1,v2.size())
		ans[a[v2[i]].S].pb(a[v2[i]].F-a[v2[i-1]].F),ans[a[v2[i]].S].pb(1),ans[a[v2[i]].S].pb(a[v2[i-1]].S+1);
	f(i,0,n){
		f(j,0,ans[i].size())
			cout<<ans[i][j]<<" ";
		cout<<'\n';
	}
}


#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
#define pb push_back
#define __V vector
#define all(x) x.begin(), x.end()
#define oit ostream_iterator
#define mod 1000000007ll
using namespace std;
void doin() {
	cin.tie();
	cout.tie();
	ios::sync_with_stdio(0);
#ifndef ONLINE_JUDGE
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif
}
template<typename X, typename Y>
istream& operator>>(istream& in, pair<X, Y> &a) {
	in >> a.first >> a.second;
	return in;
}
template<typename T>
void getv(T& i) {
	cin >> i;
}
template<typename T, typename ... Ns>
void getv(vector<T>& v, int n, Ns ... ns) {
	v.resize(n);
	for (auto& i : v)
		getv(i, ns...);
}
template<typename T>
void getv1(T& i) {
	cin >> i;
}
template<typename T, typename ... Ns>
void getv1(vector<T>& v, int n, Ns ... ns) {
	v.resize(n + 1);
	for (int i = 1; i <= n; i++)
		getv(v[i], ns...);
}
#ifdef _WIN32
#define getchar_unlocked() _getchar_nolock()
#define _CRT_DISABLE_PERFCRIT_LOCKS
#endif
inline void getch(char &x) {
	while (x = getchar_unlocked(), x < 33) {
		;
	}
}
inline void getstr(string &str) {
	str.clear();
	char cur;
	while (cur = getchar_unlocked(), cur < 33) {
		;
	}
	while (cur > 32) {
		str += cur;
		cur = getchar_unlocked();
	}
}
template<typename T> inline bool sc(T &num) {
	bool neg = 0;
	int c;
	num = 0;
	while (c = getchar_unlocked(), c < 33) {
		if (c == EOF)
			return false;
	}
	if (c == '-') {
		neg = 1;
		c = getchar_unlocked();
	}
	for (; c > 47; c = getchar_unlocked())
		num = num * 10 + c - 48;
	if (neg)
		num *= -1;
	return true;
}
typedef unsigned long long ull;
typedef long long ll;
typedef float ld;
typedef int _I;
typedef pair<ll, ll> pi;
typedef pair<ld, ld> pd;
typedef map<_I, _I> mii;
typedef __V <_I> vi;
typedef __V <char> vc;
typedef __V <ld> vd;
typedef __V <vd> vvd;
typedef __V <pi> vpi;
typedef __V <__V<_I>> vvi;
typedef __V <__V<char>> vvc;
typedef __V <__V<pi>> vvpi;
using AntonTsypko = void;
using arsijo = AntonTsypko;
using god = arsijo;
uniform_real_distribution<double> double_dist(0, 1);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int n, s, first[70010], single[70010], child[70010];
bitset<70010> dp;
vi a, chain;

void updfirst(bitset<70010>& a, int idx) {
	int i = a._Find_first();
	while(i <= s) {
		first[i] = idx;
		i = a._Find_next(i);
	}
}

void knapstack() {
	bitset<70010> _dp[2];
	bitset<70010> dif;
	_dp[1].set(0);
	for(int it = 0; it < n; it++) {
		int i = it&1;
		_dp[i] = _dp[i^1]|(_dp[i^1]<<a[it]);
		dif = _dp[i] ^ _dp[i^1];
		updfirst(dif, it);
	}
	dp = _dp[(n-1)&1];
}

void backtrack(int sm = s) {
	if(!sm) return;
	single[first[sm]] = 1;
	backtrack(sm - a[first[sm]]);
}

int main() {
	doin();
	cin >> n >> s;
	getv(a, n);
	knapstack();
	auto it = max_element(all(a));
	int amax = *it, amaxi = it-a.begin();
	if(amax > s || !dp.test(s-a.back()) || !dp.test(s)) {
		cout << -1;
		return 0;
	}
	chain.pb({amaxi});
	backtrack();
	for(int i = 0; i < n; i++)
		if(!single[i]) chain.pb(i);
	sort(all(chain), [](const int& i, const int& j) {
		return a[i] > a[j];
	});
	for(int i = 0; i < n; i++) child[i] = -1;
	for(int i = 1; i < chain.size(); i++) {
		child[chain[i-1]] = chain[i];//, cout << chain[i] << " " << chain[i-1] << "\n";
	}
	for(int i = 0; i < n; i++) {
//		cout << child[i] << "\n";
		cout << (child[i] != -1 ? a[i]-a[child[i]] : a[i]) << " ";
		if(child[i] != -1)
			cout << "1 " << child[i]+1;
		else
			cout << "0";
		cout << "\n";
	}
}


#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
#define pb push_back
#define __V vector
#define all(x) x.begin(), x.end()
#define oit ostream_iterator
#define mod 1000000007ll
using namespace std;
void doin() {
	cin.tie();
	cout.tie();
	ios::sync_with_stdio(0);
#ifndef ONLINE_JUDGE
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif
}
template<typename X, typename Y>
istream& operator>>(istream& in, pair<X, Y> &a) {
	in >> a.first >> a.second;
	return in;
}
template<typename T>
void getv(T& i) {
	cin >> i;
}
template<typename T, typename ... Ns>
void getv(vector<T>& v, int n, Ns ... ns) {
	v.resize(n);
	for (auto& i : v)
		getv(i, ns...);
}
template<typename T>
void getv1(T& i) {
	cin >> i;
}
template<typename T, typename ... Ns>
void getv1(vector<T>& v, int n, Ns ... ns) {
	v.resize(n + 1);
	for (int i = 1; i <= n; i++)
		getv(v[i], ns...);
}
#ifdef _WIN32
#define getchar_unlocked() _getchar_nolock()
#define _CRT_DISABLE_PERFCRIT_LOCKS
#endif
inline void getch(char &x) {
	while (x = getchar_unlocked(), x < 33) {
		;
	}
}
inline void getstr(string &str) {
	str.clear();
	char cur;
	while (cur = getchar_unlocked(), cur < 33) {
		;
	}
	while (cur > 32) {
		str += cur;
		cur = getchar_unlocked();
	}
}
template<typename T> inline bool sc(T &num) {
	bool neg = 0;
	int c;
	num = 0;
	while (c = getchar_unlocked(), c < 33) {
		if (c == EOF)
			return false;
	}
	if (c == '-') {
		neg = 1;
		c = getchar_unlocked();
	}
	for (; c > 47; c = getchar_unlocked())
		num = num * 10 + c - 48;
	if (neg)
		num *= -1;
	return true;
}
typedef unsigned long long ull;
typedef long long ll;
typedef float ld;
typedef int _I;
typedef pair<ll, ll> pi;
typedef pair<ld, ld> pd;
typedef map<_I, _I> mii;
typedef __V <_I> vi;
typedef __V <char> vc;
typedef __V <ld> vd;
typedef __V <vd> vvd;
typedef __V <pi> vpi;
typedef __V <__V<_I>> vvi;
typedef __V <__V<char>> vvc;
typedef __V <__V<pi>> vvpi;
using AntonTsypko = void;
using arsijo = AntonTsypko;
using god = arsijo;
uniform_real_distribution<double> double_dist(0, 1);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int n, s, first[70010], single[70010], child[70010];
bitset<70010> dp;
vi a, chain;

void updfirst(bitset<70010>& a, int idx) {
	int i = a._Find_first();
	while(i <= s) {
		first[i] = idx;
		i = a._Find_next(i);
	}
}

void knapstack() {
	bitset<70010> _dp[2];
	bitset<70010> dif;
	_dp[1].set(0);
	for(int it = 0; it < n; it++) {
		int i = it&1;
		_dp[i] = _dp[i^1]|(_dp[i^1]<<a[it]);
		dif = _dp[i] ^ _dp[i^1];
		updfirst(dif, it);
	}
	dp = _dp[(n-1)&1];
}

void backtrack(int sm = s) {
	if(!sm) return;
	single[first[sm]] = 1;
	backtrack(sm - a[first[sm]]);
}

int main() {
	doin();
	cin >> n >> s;
	getv(a, n);
	knapstack();
	auto it = max_element(all(a));
	int amax = *it, amaxi = it-a.begin();
	if(amax > s || !dp.test(s-amax) || !dp.test(s)) {
		cout << -1;
		return 0;
	}
	chain.pb({amaxi});
	backtrack();
	for(int i = 0; i < n; i++)
		if(!single[i]) chain.pb(i);
	sort(all(chain), [](const int& i, const int& j) {
		return a[i] > a[j];
	});
	for(int i = 0; i < n; i++) child[i] = -1;
	for(int i = 1; i < chain.size(); i++) {
		child[chain[i-1]] = chain[i];
	}
	for(int i = 0; i < n; i++) {
		cout << (child[i] != -1 ? a[i]-a[child[i]] : a[i]) << " ";
		if(child[i] != -1)
			cout << "1 " << child[i]+1;
		else
			cout << "0";
		cout << "\n";
	}
}


#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
#define pb push_back
#define __V vector
#define all(x) x.begin(), x.end()
#define oit ostream_iterator
#define mod 1000000007ll
using namespace std;
void doin() {
	cin.tie();
	cout.tie();
	ios::sync_with_stdio(0);
#ifndef ONLINE_JUDGE
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif
}
template<typename X, typename Y>
istream& operator>>(istream& in, pair<X, Y> &a) {
	in >> a.first >> a.second;
	return in;
}
template<typename T>
void getv(T& i) {
	cin >> i;
}
template<typename T, typename ... Ns>
void getv(vector<T>& v, int n, Ns ... ns) {
	v.resize(n);
	for (auto& i : v)
		getv(i, ns...);
}
template<typename T>
void getv1(T& i) {
	cin >> i;
}
template<typename T, typename ... Ns>
void getv1(vector<T>& v, int n, Ns ... ns) {
	v.resize(n + 1);
	for (int i = 1; i <= n; i++)
		getv(v[i], ns...);
}
#ifdef _WIN32
#define getchar_unlocked() _getchar_nolock()
#define _CRT_DISABLE_PERFCRIT_LOCKS
#endif
inline void getch(char &x) {
	while (x = getchar_unlocked(), x < 33) {
		;
	}
}
inline void getstr(string &str) {
	str.clear();
	char cur;
	while (cur = getchar_unlocked(), cur < 33) {
		;
	}
	while (cur > 32) {
		str += cur;
		cur = getchar_unlocked();
	}
}
template<typename T> inline bool sc(T &num) {
	bool neg = 0;
	int c;
	num = 0;
	while (c = getchar_unlocked(), c < 33) {
		if (c == EOF)
			return false;
	}
	if (c == '-') {
		neg = 1;
		c = getchar_unlocked();
	}
	for (; c > 47; c = getchar_unlocked())
		num = num * 10 + c - 48;
	if (neg)
		num *= -1;
	return true;
}
typedef unsigned long long ull;
typedef long long ll;
typedef float ld;
typedef int _I;
typedef pair<ll, ll> pi;
typedef pair<ld, ld> pd;
typedef map<_I, _I> mii;
typedef __V <_I> vi;
typedef __V <char> vc;
typedef __V <ld> vd;
typedef __V <vd> vvd;
typedef __V <pi> vpi;
typedef __V <__V<_I>> vvi;
typedef __V <__V<char>> vvc;
typedef __V <__V<pi>> vvpi;
using AntonTsypko = void;
using arsijo = AntonTsypko;
using god = arsijo;
uniform_real_distribution<double> double_dist(0, 1);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int n, s, first[70010], single[70010], child[70010];
bitset<70010> dp;
vi a, chain;

void updfirst(bitset<70010>& a, int idx) {
	int i = a._Find_first();
	while(i <= s) {
		first[i] = idx;
		i = a._Find_next(i);
	}
}

void knapstack() {
	bitset<70010> _dp[2];
	bitset<70010> dif;
	_dp[1].set(0);
	for(int it = 0; it < n; it++) {
		int i = it&1;
		_dp[i] = _dp[i^1]|(_dp[i^1]<<a[it]);
		dif = _dp[i] ^ _dp[i^1];
		updfirst(dif, it);
	}
	dp = _dp[(n-1)&1];
}

void backtrack(int sm = s) {
	if(!sm) return;
	single[first[sm]] = 1;
	backtrack(sm - a[first[sm]]);
}

int main() {
	doin();
	cin >> n >> s;
	getv(a, n);
	knapstack();
	auto it = max_element(all(a));
	int amax = *it, amaxi = it-a.begin();
	if(amax > s || !dp.test(s) || !dp.test(s-amax)) {
		cout << -1;
		return 0;
	}
	chain.pb({amaxi});
	backtrack();
	for(int i = 0; i < n; i++)
		if(!single[i]) chain.pb(i);
	sort(all(chain), [](const int& i, const int& j) {
		return a[i] < a[j];
	});
	for(int i = 0; i < n; i++) child[i] = -1;
	for(int i = 1; i < chain.size(); i++) {
		child[chain[i]] = chain[i-1];
	}
	for(int i = 0; i < n; i++) {
		cout << (child[i] != -1 ? a[i]-a[child[i]] : a[i]) << " ";
		if(child[i] != -1)
			cout << "1 " << child[i]+1;
		else
			cout << "0";
		cout << "\n";
	}
}


#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
#define pb push_back
#define __V vector
#define all(x) x.begin(), x.end()
#define oit ostream_iterator
#define mod 1000000007ll
using namespace std;
void doin() {
	cin.tie();
	cout.tie();
	ios::sync_with_stdio(0);
#ifndef ONLINE_JUDGE
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif
}
template<typename X, typename Y>
istream& operator>>(istream& in, pair<X, Y> &a) {
	in >> a.first >> a.second;
	return in;
}
template<typename T>
void getv(T& i) {
	cin >> i;
}
template<typename T, typename ... Ns>
void getv(vector<T>& v, int n, Ns ... ns) {
	v.resize(n);
	for (auto& i : v)
		getv(i, ns...);
}
template<typename T>
void getv1(T& i) {
	cin >> i;
}
template<typename T, typename ... Ns>
void getv1(vector<T>& v, int n, Ns ... ns) {
	v.resize(n + 1);
	for (int i = 1; i <= n; i++)
		getv(v[i], ns...);
}
#ifdef _WIN32
#define getchar_unlocked() _getchar_nolock()
#define _CRT_DISABLE_PERFCRIT_LOCKS
#endif
inline void getch(char &x) {
	while (x = getchar_unlocked(), x < 33) {
		;
	}
}
inline void getstr(string &str) {
	str.clear();
	char cur;
	while (cur = getchar_unlocked(), cur < 33) {
		;
	}
	while (cur > 32) {
		str += cur;
		cur = getchar_unlocked();
	}
}
template<typename T> inline bool sc(T &num) {
	bool neg = 0;
	int c;
	num = 0;
	while (c = getchar_unlocked(), c < 33) {
		if (c == EOF)
			return false;
	}
	if (c == '-') {
		neg = 1;
		c = getchar_unlocked();
	}
	for (; c > 47; c = getchar_unlocked())
		num = num * 10 + c - 48;
	if (neg)
		num *= -1;
	return true;
}
typedef unsigned long long ull;
typedef long long ll;
typedef float ld;
typedef int _I;
typedef pair<ll, ll> pi;
typedef pair<ld, ld> pd;
typedef map<_I, _I> mii;
typedef __V <_I> vi;
typedef __V <char> vc;
typedef __V <ld> vd;
typedef __V <vd> vvd;
typedef __V <pi> vpi;
typedef __V <__V<_I>> vvi;
typedef __V <__V<char>> vvc;
typedef __V <__V<pi>> vvpi;
using AntonTsypko = void;
using arsijo = AntonTsypko;
using god = arsijo;
uniform_real_distribution<double> double_dist(0, 1);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int n, s, first[70010], single[70010], child[70010];
bitset<70010> dp;
vi a, chain;

void updfirst(bitset<70010>& a, int idx) {
	int i = a._Find_first();
	while(i <= s) {
		first[i] = idx;
		i = a._Find_next(i);
	}
}

void knapstack() {
	bitset<70010> _dp[2];
	bitset<70010> dif;
	_dp[1].set(0);
	for(int it = 0; it < n; it++) {
		int i = it&1;
		_dp[i] = _dp[i^1]|(_dp[i^1]<<a[it]);
		dif = _dp[i] ^ _dp[i^1];
		updfirst(dif, it);
	}
	dp = _dp[(n-1)&1];
}

void backtrack(int sm = s) {
	if(!sm) return;
	single[first[sm]] = 1;
	backtrack(sm - a[first[sm]]);
}

int main() {
	doin();
	cin >> n >> s;
	getv(a, n);
	auto it = max_element(all(a));
	int amax = *it, amaxi = it-a.begin();
	swap(a[0], a[amaxi]);
	knapstack();
	if(amax > s || !dp.test(s) || !dp.test(s-amax)) {
		cout << -1;
		return 0;
	}
	chain.pb({amaxi});
	backtrack();
	swap(a[0], a[amaxi]);
	swap(single[0], single[amaxi]);
	for(int i = 0; i < n; i++)
		if(!single[i]) chain.pb(i);
	sort(all(chain), [](const int& i, const int& j) {
		return a[i] < a[j];
	});
	for(int i = 0; i < n; i++) child[i] = -1;
	for(int i = 1; i < chain.size(); i++) {
		child[chain[i]] = chain[i-1];
	}
	for(int i = 0; i < n; i++) {
		cout << (child[i] != -1 ? a[i]-a[child[i]] : a[i]) << " ";
		if(child[i] != -1)
			cout << "1 " << child[i]+1;
		else
			cout << "0";
		cout << "\n";
	}
}


#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
#define pb push_back
#define __V vector
#define all(x) x.begin(), x.end()
#define oit ostream_iterator
#define mod 1000000007ll
using namespace std;
void doin() {
	cin.tie();
	cout.tie();
	ios::sync_with_stdio(0);
#ifndef ONLINE_JUDGE
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif
}
template<typename X, typename Y>
istream& operator>>(istream& in, pair<X, Y> &a) {
	in >> a.first >> a.second;
	return in;
}
template<typename T>
void getv(T& i) {
	cin >> i;
}
template<typename T, typename ... Ns>
void getv(vector<T>& v, int n, Ns ... ns) {
	v.resize(n);
	for (auto& i : v)
		getv(i, ns...);
}
template<typename T>
void getv1(T& i) {
	cin >> i;
}
template<typename T, typename ... Ns>
void getv1(vector<T>& v, int n, Ns ... ns) {
	v.resize(n + 1);
	for (int i = 1; i <= n; i++)
		getv(v[i], ns...);
}
#ifdef _WIN32
#define getchar_unlocked() _getchar_nolock()
#define _CRT_DISABLE_PERFCRIT_LOCKS
#endif
inline void getch(char &x) {
	while (x = getchar_unlocked(), x < 33) {
		;
	}
}
inline void getstr(string &str) {
	str.clear();
	char cur;
	while (cur = getchar_unlocked(), cur < 33) {
		;
	}
	while (cur > 32) {
		str += cur;
		cur = getchar_unlocked();
	}
}
template<typename T> inline bool sc(T &num) {
	bool neg = 0;
	int c;
	num = 0;
	while (c = getchar_unlocked(), c < 33) {
		if (c == EOF)
			return false;
	}
	if (c == '-') {
		neg = 1;
		c = getchar_unlocked();
	}
	for (; c > 47; c = getchar_unlocked())
		num = num * 10 + c - 48;
	if (neg)
		num *= -1;
	return true;
}
typedef unsigned long long ull;
typedef long long ll;
typedef float ld;
typedef int _I;
typedef pair<ll, ll> pi;
typedef pair<ld, ld> pd;
typedef map<_I, _I> mii;
typedef __V <_I> vi;
typedef __V <char> vc;
typedef __V <ld> vd;
typedef __V <vd> vvd;
typedef __V <pi> vpi;
typedef __V <__V<_I>> vvi;
typedef __V <__V<char>> vvc;
typedef __V <__V<pi>> vvpi;
using AntonTsypko = void;
using arsijo = AntonTsypko;
using god = arsijo;
uniform_real_distribution<double> double_dist(0, 1);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int n, s, first[70010], single[70010], child[70010];
bitset<70010> dp;
vi a, chain;

void updfirst(bitset<70010>& a, int idx) {
	int i = a._Find_first();
	while(i <= s) {
		first[i] = idx;
		i = a._Find_next(i);
	}
}

void knapstack() {
	bitset<70010> _dp[2];
	bitset<70010> dif;
	_dp[1].set(0);
	for(int it = 0; it < n; it++) {
		int i = it&1;
		_dp[i] = _dp[i^1]|(_dp[i^1]<<a[it]);
		dif = _dp[i] ^ _dp[i^1];
		updfirst(dif, it);
	}
	dp = _dp[(n-1)&1];
}

void backtrack(int sm = s) {
	if(!sm) return;
	single[first[sm]] = 1;
	backtrack(sm - a[first[sm]]);
}

int main() {
	doin();
	cin >> n >> s;
	getv(a, n);
	knapstack();
	auto it = max_element(all(a));
	int amax = *it, amaxi = it-a.begin();
	if(amax > s || !dp.test(s-amax)) {
		cout << -1;
		return 0;
	}
	chain.pb({amaxi});
	backtrack();
	for(int i = 0; i < n; i++)
		if(!single[i]) chain.pb(i);
	sort(all(chain), [](const int& i, const int& j) {
		return a[i] < a[j];
	});
	for(int i = 0; i < n; i++) child[i] = -1;
	for(int i = 1; i < chain.size(); i++) {
		child[chain[i]] = chain[i-1];
	}
	for(int i = 0; i < n; i++) {
		cout << (child[i] != -1 ? a[i]-a[child[i]] : a[i]) << " ";
		if(child[i] != -1)
			cout << "1 " << child[i]+1;
		else
			cout << "0";
		cout << "\n";
	}
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int  ,int > pii;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll maxn  = 70100;
const ll mod =1e9+7;
const ld PI = acos((ld)-1);

#define pb(x) push_back(x);
#define endl '\n'
#define dokme(x) return(cout << x , 0);
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ms(x , y) memset(x , y , sizeof x);
#define file_init freopen("input.txt", "r+", stdin); freopen("output.txt", "w+", stdout);
ll pw(ll a, ll b, ll md = mod){ll res = 1;while(b){if(b&1){res=(a*res)%md;}a=(a*a)%md;b>>=1;}return(res);}

pii a[maxn];
int n , s;
bitset < maxn > dp , dummy , nw;
int par[maxn];
int coin[maxn] , pr[maxn];
bool mark[maxn];
int val[maxn];
vector < int > num[maxn];

int main(){
    migmig
    cin >> n >> s;
    for(int i = 0 ; i < n ; i ++){
		cin >> a[i].first;
		val[i] = a[i].first;
		a[i].second = i;
		num[val[i]].pb(i);
	}
	ms(par , -1);
	sort(a , a + n);
	reverse(a , a + n);
	if(a[0].first > s)
		dokme(-1);
	int sum = 0;
	for(int i = 0 ; i < n ; i ++)
		sum+=a[i].first;
	if(sum < s)	dokme(-1);
	dp[0] = 1;
	par[0] = -1;
	for(int i = 0; i < n ; i ++){
		dummy = dp;
		dummy[a[i].first] = 1;
		nw = dp^(dummy|(dp << a[i].first));
		dp=dummy|(dp << a[i].first);
		int cur = nw._Find_first();
		while(cur!=maxn){
			par[cur] = a[i].first;
			cur = nw._Find_next(cur);
		}
	}
    if(!dp[s])
		dokme(-1);
	int boz = num[par[s]].back();
    while(s){
		mark[num[par[s]].back()] = 1;
		num[par[s]].pop_back();
		s-=par[s];
	}
	mark[boz] = 0;
    int cur = 0;
    int prev = -1;
    ms(pr , -1);
    reverse(a , a + n);
    for(int i = 0; i < n ; i ++){
		if(mark[a[i].second]) {
			coin[a[i].second] = val[a[i].second];
			continue;
		}
		coin[a[i].second] = val[a[i].second] - cur;
		cur = val[a[i].second];
		if(prev!=-1){
			pr[a[i].second] = prev;
		}
		prev = a[i].second+1;
	}
	for(int i = 0 ; i < n ; i ++){
		if(pr[i] == -1){
			cout << coin[i] << " 0 " << endl;
		}
		else{
			cout << coin[i] << " 1 " << pr[i] << endl;
		}
	}

    return(0);
}

//When we hit our lowest point, we are open to the greatest change.
//If I try, I fail. If I don't try, I'm NEVER GOING TO GET IT.
//Sometimes, life is like this dark tunnel. You can't always see the light at the end of the tunnel. But if you just keep moving... you will come to a better place.
//It is important to draw wisdom from diffrent places. If you take it from only one place it becomes rigid and stale.
//kuxtal jach uts chuchul u u páajtal máak jach táaj meyajilo'ob le castigadas tumen ch'aik descansos.


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int  ,int > pii;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll maxn  = 70100;
const ll mod =1e9+7;
const ld PI = acos((ld)-1);

#define pb(x) push_back(x);
#define endl '\n'
#define dokme(x) return(cout << x , 0);
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ms(x , y) memset(x , y , sizeof x);
#define file_init freopen("input.txt", "r+", stdin); freopen("output.txt", "w+", stdout);
ll pw(ll a, ll b, ll md = mod){ll res = 1;while(b){if(b&1){res=(a*res)%md;}a=(a*a)%md;b>>=1;}return(res);}

pii a[maxn];
int n , s;
bitset < maxn > dp , dummy , nw;
int par[maxn];
int coin[maxn] , pr[maxn];
bool mark[maxn];
int val[maxn];

int main(){
    migmig
    cin >> n >> s;
    for(int i = 0 ; i < n ; i ++){
		cin >> a[i].first;
		val[i] = a[i].first;
		a[i].second = i;
	}
	ms(par , -1);
	sort(a , a + n);
	reverse(a , a + n);
	if(a[0].first > s)
		dokme(-1);
	int sum = 0;
	for(int i = 0 ; i < n ; i ++)
		sum+=a[i].first;
	if(sum < s)	dokme(-1);
	dp[a[0].first] = 1;
	par[a[0].first] = a[0].second;
	for(int i = 1; i < n ; i ++){
		dummy = dp;
		dummy[a[i].first] = 1;
		nw = dp^(dummy|(dp << a[i].first));
		dp=dummy|(dp << a[i].first);
		int cur = nw._Find_first();
		while(cur!=maxn){
			par[cur] = a[i].second;
			cur = nw._Find_next(cur);
		}
	}
    if(!dp[s])
		dokme(-1);
    s-=a[0].first;
    while(s){
		if(par[s] == -1)dokme(-1);
		mark[par[s]] = 1;
		s -= val[par[s]];
	}
	reverse(a , a + n);
	int cur = 0;
	int prev = -1;
	for(int i = 0; i < n ; i ++){
		if(mark[a[i].second]){
			coin[a[i].second] = a[i].first;
			continue;
		}
		if(cur!=a[i].first){
			coin[a[i].second] = a[i].first - cur;
		}
		cur = a[i].first;
		if(prev!=-1)
			pr[a[i].second]=prev+1;
		prev = a[i].second;
	}
	for(int i = 0 ; i < n ; i ++){
		cout << coin[i] << ' ';
		if(pr[i])
			cout << 1 << ' ' << pr[i];
		else
			cout << 0;
		cout << endl;
	}
    return(0);
}

//When we hit our lowest point, we are open to the greatest change.
//If I try, I fail. If I don't try, I'm NEVER GOING TO GET IT.
//Sometimes, life is like this dark tunnel. You can't always see the light at the end of the tunnel. But if you just keep moving... you will come to a better place.
//It is important to draw wisdom from diffrent places. If you take it from only one place it becomes rigid and stale.
//kuxtal jach uts chuchul u u páajtal máak jach táaj meyajilo'ob le castigadas tumen ch'aik descansos.


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int  ,int > pii;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll maxn  = 70100;
const ll mod =1e9+7;
const ld PI = acos((ld)-1);

#define pb(x) push_back(x);
#define endl '\n'
#define dokme(x) return(cout << x , 0);
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ms(x , y) memset(x , y , sizeof x);
#define file_init freopen("input.txt", "r+", stdin); freopen("output.txt", "w+", stdout);
ll pw(ll a, ll b, ll md = mod){ll res = 1;while(b){if(b&1){res=(a*res)%md;}a=(a*a)%md;b>>=1;}return(res);}

pii a[maxn];
int n , s;
bitset < maxn > dp , dummy , nw;
int par[maxn];
int coin[maxn] , pr[maxn];
bool mark[maxn];
int val[maxn];
vector < int > num[maxn];

int main(){
    migmig
    cin >> n >> s;
    for(int i = 0 ; i < n ; i ++){
		cin >> a[i].first;
		val[i] = a[i].first;
		a[i].second = i;
	}
	ms(par , -1);
	sort(a , a + n);
	reverse(a , a + n);
	for(int  i = 0 ; i < n ; i ++)
		num[a[i].first].pb(a[i].second);
	if(a[0].first > s)
		dokme(-1);
	int sum = 0;
	for(int i = 0 ; i < n ; i ++)
		sum+=a[i].first;
	if(sum < s)	dokme(-1);
	dp[a[0].first] = 1;
	par[a[0].first] = a[0].first;
	dp[0] = 1;
	for(int i = n-1; i >=0 ; i --){
		dummy = dp;
		dummy[a[i].first] = 1;
		nw = dp^(dummy|(dp << a[i].first));
		dp=dummy|(dp << a[i].first);
		int cur = nw._Find_first();
		while(cur!=maxn){
			par[cur] = a[i].first;
			cur = nw._Find_next(cur);
		}
	}
    if(!dp[s])
		dokme(-1);
	s-=a[0].first;
	num[a[0].first].pop_back();
    while(s){
		if(par[s] == -1)dokme(-1);
		mark[num[par[s]].back()] = 1;
		num[par[s]].pop_back();
		s-=par[s];
	}
    int cur = 0;
    int prev = -1;
    ms(pr , -1);
    reverse(a , a + n);
    for(int i = 0; i < n ; i ++){
		if(mark[a[i].second]){
			coin[a[i].second] = val[a[i].second];
			continue;
		}
		coin[a[i].second] = val[a[i].second] - cur;
		cur = val[a[i].second];
		if(prev!=-1){
			pr[a[i].second] = prev;
		}
		prev = a[i].second+1;
	}
	for(int i = 0 ; i < n ; i ++){
		if(pr[i] == -1){
			cout << coin[i] << " 0 " << endl;
		}
		else{
			cout << coin[i] << " 1 " << pr[i] << endl;
		}
	}

    return(0);
}

//When we hit our lowest point, we are open to the greatest change.
//If I try, I fail. If I don't try, I'm NEVER GOING TO GET IT.
//Sometimes, life is like this dark tunnel. You can't always see the light at the end of the tunnel. But if you just keep moving... you will come to a better place.
//It is important to draw wisdom from diffrent places. If you take it from only one place it becomes rigid and stale.
//kuxtal jach uts chuchul u u páajtal máak jach táaj meyajilo'ob le castigadas tumen ch'aik descansos.


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int  ,int > pii;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll maxn  = 70100;
const ll mod =1e9+7;
const ld PI = acos((ld)-1);

#define pb(x) push_back(x);
#define endl '\n'
#define dokme(x) return(cout << x , 0);
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ms(x , y) memset(x , y , sizeof x);
#define file_init freopen("input.txt", "r+", stdin); freopen("output.txt", "w+", stdout);
ll pw(ll a, ll b, ll md = mod){ll res = 1;while(b){if(b&1){res=(a*res)%md;}a=(a*a)%md;b>>=1;}return(res);}

pii a[maxn];
int n , s;
bitset < maxn > dp , dummy , nw;
int par[maxn];
int coin[maxn] , pr[maxn];
bool mark[maxn];
int val[maxn];

int main(){
    migmig
    cin >> n >> s;
    for(int i = 0 ; i < n ; i ++){
		cin >> a[i].first;
		val[i] = a[i].first;
		a[i].second = i;
	}
	ms(par , -1);
	sort(a , a + n);
	reverse(a , a + n);
	if(a[0].first > s)
		dokme(-1);
	int sum = 0;
	for(int i = 0 ; i < n ; i ++)
		sum+=a[i].first;
	if(sum < s)	dokme(-1);
	dp[a[0].first] = 1;
	par[a[0].first] = a[0].second;
	for(int i = 1; i < n ; i ++){
		dummy = dp;
		dummy[a[i].first] = 1;
		nw = dp^(dummy|(dp << a[i].first));
		dp=dummy|(dp << a[i].first);
		int cur = nw._Find_first();
		while(cur!=maxn){
			par[cur] = a[i].second;
			cur = nw._Find_next(cur);
		}
	}
    if(!dp[s])
		dokme(-1);
    s-=a[0].first;
    while(s){
		if(par[s] == -1)dokme(-1);
		mark[par[s]] = 1;
		s -= val[par[s]];
	}
	reverse(a , a + n);
	int cur = 0;
	int prev = -1;
	for(int i = 0; i < n ; i ++){
		if(mark[a[i].second]){
			coin[a[i].second] = a[i].first;
			continue;
		}
		if(cur!=a[i].first){
			coin[a[i].second] = a[i].first - cur;
		}
		cur+=coin[a[i].second];
		if(prev!=-1)
			pr[a[i].second]=prev+1;
		prev = a[i].second;
	}
	for(int i = 0 ; i < n ; i ++){
		cout << coin[i] << ' ';
		if(pr[i])
			cout << 1 << ' ' << pr[i];
		else
			cout << 0;
		cout << endl;
	}
    return(0);
}

//When we hit our lowest point, we are open to the greatest change.
//If I try, I fail. If I don't try, I'm NEVER GOING TO GET IT.
//Sometimes, life is like this dark tunnel. You can't always see the light at the end of the tunnel. But if you just keep moving... you will come to a better place.
//It is important to draw wisdom from diffrent places. If you take it from only one place it becomes rigid and stale.
//kuxtal jach uts chuchul u u páajtal máak jach táaj meyajilo'ob le castigadas tumen ch'aik descansos.