#include <bits/stdc++.h>
using namespace std;
long long int bt[50 + 10];
map<int, int> MAP;
int main() {
  long long int a, b, c, d, e, f, m, n, p, q, x, y, z, w, k;
  vector<long long int> v[2525], temp;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    bt[i] = x;
    temp.push_back(x);
  }
  sort(temp.begin(), temp.end(), greater<long long int>());
  for (int i = 0; i < temp.size(); i++) {
    v[i + 1].push_back(temp[i]);
  }
  if (n >= k) {
    for (int i = 1; i <= k; i++) {
      cout << 1 << " " << bt[i] << endl;
    }
  } else {
    long long int start = 2;
    long long int end = n;
    long long int mul = 1;
    long long int cnt = 1;
    int p = 0;
    long long int get = n + 1;
    while (get - 1 < k) {
      for (int i = start; i <= end; i++) {
        v[get] = v[i];
        v[get].insert(v[get].end(), v[mul].begin(), v[mul].end());
        get++;
      }
      start = end + 2;
      end = get - 1;
      mul++;
    }
    for (int i = 1; i <= k; i++) {
      cout << v[i].size() << " ";
      long long int lmt = v[i].size();
      cout << v[i][0];
      for (int j = 1; j < lmt; j++) {
        cout << " " << v[i][j];
      }
      cout << endl;
    }
  }
  return (0);
}
