#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n;
  cin >> k;
  vector<int> v;
  int x;
  for (int i = 0; i < n; ++i) {
    cin >> x;
    v.push_back(x);
  }
  std::sort(v.begin(), v.end());
  for (int i = 0; i < k; ++i) {
    int s = 0;
    int nr_numere;
    int offset;
    for (int j = 0; j < n; ++j) {
      s = s + n - j;
      if (s > i) {
        nr_numere = j + 1;
        offset = i - (s - (n - j));
        break;
      }
    }
    cout << nr_numere << " ";
    for (int j = 0; j < nr_numere - 1; ++j) {
      cout << v[n - 1 - j] << " ";
    }
    cout << v[offset] << endl;
  }
  return 0;
}
