#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <cassert>
#include <map>
#define int long long
using namespace std;

void solve() {
    int n, k;
    cin >> n >> k;
    vector<pair<int, int>> dp(1 << (k + 2), {1e18, -1e18});
    vector<pair<int, int>> h;
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        h.push_back({x, i});
    }
    dp[0] = {0, 0};
    for (int i = 0; i < 1 << (k + 2); ++i) {
        if (dp[i].first > dp[i].second) {
            continue;
        }
        vector<int> st;
        for (int j = 0; j < k + 2; ++j) {
            if ((1 << j) & i) {
                st.push_back(1 << (j + 1));
            }
        }
        reverse(st.begin(), st.end());
        if (st.size() == k) {
            continue;
        }
        int mn1 = dp[i].first, mx1 = dp[i].second;
        int to_add = 0;
        for (int j = to_add; (1 << j) & i; ++j) {
            mn1 += 2 * (1 << (j + 1));
            mx1 += 2 * (1 << (j + 1));
        }
        to_add = 1;
        int mn2 = dp[i].first, mx2 = dp[i].second;
        for (int j = to_add; (1 << j) & i; ++j) {
            mn2 += 2 * (1 << (j + 1));
            mx2 += 2 * (1 << (j + 1));
        }
        int to1 = i + 1;
        int to2 = i + 2;
        dp[to1].first = min(dp[to1].first, mn1);
        dp[to1].second = max(dp[to1].second, mx1);
        dp[to2].first = min(dp[to2].first, mn2);
        dp[to2].second = max(dp[to2].second, mx2);
    }
    sort(h.begin(), h.end());
    int ind = 0;
    vector<int> ans(n);
    for (int i = 0; i < n; ++i) {
        int x = h[i].first;
        if (x % 4 != 0) {
            ans[h[i].second] = -1;
            continue;
        }
        while (ind < dp.size() && dp[ind].second < x) {
            ind++;
        }
        if (ind == dp.size()) {
            ans[h[i].second] = -1;
            continue;
        }
        if (dp[ind].first <= x && dp[ind].second >= x) {
            ans[h[i].second] = ind;
        }
    }
    for (auto x: ans) {
        if (x == -1) {
            cout << "-1\n";
            continue;
        }
        vector<int> st;
        for (int j = 0; j < k + 2; ++j) {
            if ((1 << j) & x) {
                st.push_back(1 << (j + 1));
            }
        }
        cout << st.size() << " ";
        for (auto y: st) {
            cout << y << " ";
        }
        cout << "\n";
    }


}

signed main() {
    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
}