#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  map<long long, vector<long long> > mp;
  sort(a.rbegin(), a.rend());
  vector<long long> v;
  for (long long i = 0; i < n; i++) {
    v.push_back(a[i]);
    mp[i] = v;
  }
  for (long long i = 1; i < n; i++) {
    mp[i + n - 1].push_back(a[i]);
  }
  long long ct = 2 * n - 1;
  for (long long i = 0; i < n; i++) {
    vector<long long> v = mp[i];
    for (long long j = i + 2; j < n; j++) {
      mp[ct] = v;
      mp[ct].push_back(a[j]);
      ct++;
    }
  }
  for (long long i = 0; i < k; i++) {
    cout << mp[i].size() << " ";
    for (long long j = 0; j < mp[i].size(); j++) {
      cout << mp[i][j] << " ";
    }
    cout << endl;
  }
}
