#include <bits/stdc++.h>
using namespace std;
const int INF = 999999999;
const double EPSILON = 0.00000001;
const long long MOD = 1000000007;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    ;
  }
  sort(a.begin(), a.end());
  vector<int> sums;
  vector<vector<int> > ways;
  sums.push_back(0);
  vector<int> empty;
  ways.push_back(empty);
  int i = 0, cnt = 0;
  while (i < n and cnt < k) {
    int z = sums.size();
    for (int j = 0; j < z; j++) {
      int s = sums[j] + a[i];
      if (find(sums.begin(), sums.end(), s) == sums.end()) {
        vector<int> soln = ways[j];
        soln.push_back(a[i]);
        ways.push_back(soln);
        sums.push_back(s);
        cnt++;
      }
    }
    i++;
  }
  for (i = 1; i <= k; i++) {
    printf("%d ", (int)ways[i].size());
    {
      for (int _ = 0; _ < ways[i].size(); _++) cout << ways[i][_] << " ";
      cout << "\n";
    };
  }
  return 0;
}
