#include <bits/stdc++.h>
using namespace std;
const int M = 100000 + 10;
int a[M];
vector<int> ans[M];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  int num = 0;
  while (num < k) {
    for (int i = n; i >= 0 && num < k; i--) {
      for (int j = 0; j < i; j++) {
        for (int x = n - 1; x >= i; x--) {
          ans[num].push_back(a[x]);
        }
        ans[num].push_back(a[j]);
        num++;
        if (num == k) {
          break;
        }
      }
    }
  }
  for (int i = 0; i < num; i++) {
    cout << ans[i].size() << " ";
    for (int j = 0; j < ans[i].size(); j++) {
      cout << ans[i][j] << " ";
    }
    cout << endl;
  }
  return 0;
}
