#include <bits/stdc++.h>
using namespace std;
long long n, k, a[51], b[3000], p[51], cur;
int main() {
  cin >> n >> k;
  p[1] = 1;
  for (int i = 2; i <= 50; i++) {
    p[i] = p[i - 1] * 2;
  }
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  sort(a + 1, a + n + 1);
  b[1] = 1;
  for (int i = 1; i <= n; i++) {
    cur = 0;
    for (int q = 1; q <= i - 1; q++) {
      cur += n + 1 - q;
    }
    for (int j = 1; j <= n + 1 - i; j++) {
      b[cur + j] = b[cur] + p[j];
    }
  }
  for (int i = 1; i <= k; i++) {
    vector<int> t;
    int col = 0;
    while (b[i] > 0) {
      if (b[i] % 2 == 1) col++;
      t.push_back(b[i] % 2);
      b[i] /= 2;
    }
    cout << col << ' ';
    for (int j = 0; j < t.size(); j++) {
      if (t[j] != 0) {
        cout << a[j + 1] << ' ';
      }
    }
    cout << endl;
  }
  return 0;
}
