#include <bits/stdc++.h>
using namespace std;
typedef struct {
  int sum, l;
  bool f[55];
} node;
queue<node> qu;
node x, y;
map<int, int> m;
map<int, int>::iterator pos;
int main() {
  int n, k, a[55], i, j, t;
  while (scanf("%d %d", &n, &k) != EOF) {
    for (i = 0; i < n; i++) scanf("%d", &a[i]);
    x.sum = x.l = 0;
    for (i = 0; i < 55; i++) x.f[i] = true;
    while (!qu.empty()) qu.pop();
    qu.push(x);
    m.clear();
    t = 0;
    while (!qu.empty()) {
      x = qu.front();
      qu.pop();
      for (i = 0; i < n; i++) {
        if (x.f[i]) {
          y.sum = x.sum + a[i];
          pos = m.find(y.sum);
          if (pos != m.end()) continue;
          y.l = x.l + 1;
          for (j = 0; j < n; j++) y.f[j] = x.f[j];
          y.f[i] = false;
          qu.push(y);
          m.insert(pair<int, int>(y.sum, 0));
          printf("%d", y.l);
          for (j = 0; j < n; j++)
            if (!y.f[j]) printf(" %d", a[j]);
          printf("\n");
          t++;
          if (t == k) break;
        }
      }
      if (t == k) break;
    }
  }
}
