#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, vector<int> > > out;
int n, k;
int a[64];
bool found(long long x) {
  for (int i = 0; i < out.size(); i++)
    if (out[i].first == x) return true;
  return false;
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; out.size() < k && i < n; i++) {
    int sz = out.size();
    if (found(a[i]) == false) {
      vector<int> push;
      push.push_back(i);
      out.push_back(make_pair(a[i], push));
    }
    for (int j = 0; out.size() < k && j < sz; j++) {
      if (found(a[i] + out[j].first) == false) {
        out.push_back(out[j]);
        out[out.size() - 1].second.push_back(i);
        out[out.size() - 1].first += a[i];
      }
    }
  }
  for (int i = 0; i < out.size(); i++) {
    cout << out[i].second.size();
    for (int j = 0; j < out[i].second.size(); j++)
      cout << ' ' << a[out[i].second[j]];
    cout << endl;
  }
  return 0;
}
