#include <bits/stdc++.h>
using namespace std;
int a[60];
short int father[5000], use[5000];
set<int> clrs;
vector<int> clrs2;
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int i = 0;
  clrs.insert(0);
  clrs2.push_back(0);
  for (int i = 0; i < n; i++) {
    int sz = clrs.size();
    for (int j = 0; j < sz; j++) {
      if (clrs.find(clrs2[j] + a[i]) == clrs.end()) {
        father[clrs.size()] = j;
        use[clrs.size()] = i;
        clrs.insert(clrs2[j] + a[i]);
        clrs2.push_back(clrs2[j] + a[i]);
      }
      if (clrs.size() > k) break;
    }
    if (clrs.size() > k) break;
  }
  for (int i = 1; i <= k; i++) {
    int color = i, cnt = 0;
    while (color != 0) {
      color = father[color];
      cnt++;
    }
    cout << cnt << " ";
    color = i;
    while (color != 0) {
      cout << a[use[color]] << " ";
      color = father[color];
    }
    cout << endl;
  }
}
