#include <bits/stdc++.h>
using namespace std;
map<long long int, int> m;
vector<int> v[10000];
int main() {
  vector<int> v[10000];
  int n, k, i, j, x, a[60], l, p, q, f, sz, sm;
  scanf("%d%d", &n, &k);
  for (i = 0; i < n; i++) scanf("%d", &a[i]);
  i = 0;
  while (i < n && k) {
    printf("1 %d\n", a[i]);
    m[a[i]] = 1;
    v[i].push_back(a[i]);
    i++;
    k--;
  }
  j = 0;
  while (k) {
    l = i - 1;
    while (k && j <= l) {
      p = 0;
      f = 0;
      while (p < n) {
        sz = v[j].size();
        sm = 0;
        for (q = 0; q < sz; q++) {
          if (v[j][q] == a[p]) break;
          sm += v[j][q];
        }
        if (q != sz || m[sm + a[p]])
          p++;
        else {
          f = 1;
          break;
        }
      }
      if (f) {
        printf("%d ", sz + 1);
        for (q = 0; q < sz; q++) {
          printf("%d ", v[j][q]);
          v[i].push_back(v[j][q]);
        }
        v[i].push_back(a[p]);
        printf("%d\n", a[p]);
        i++;
        k--;
        m[sm + a[p]] = 1;
      }
      j++;
    }
    j = l + 1;
  }
}
