#include <bits/stdc++.h>
using namespace std;
int val[55];
int k, n;
int a, b;
set<int> found;
int sols[3000];
int pred[3000];
int id[30000];
int main() {
  scanf("%d%d", &n, &k);
  for (a = 1; a <= n; a++) scanf("%d", &val[a]);
  int snum = 1;
  sols[1] = 0;
  for (a = 1; a <= n; a++) {
    for (b = 1; b <= snum; b++)
      if (id[b] != a && found.find(sols[b] + val[a]) == found.end()) {
        int sum = sols[b] + val[a];
        found.insert(sum);
        snum++;
        id[snum] = a;
        pred[snum] = b;
        sols[snum] = sum;
        int cnt = 0;
        int now = snum;
        while (now > 1) {
          cnt++;
          now = pred[now];
        }
        printf("%d ", cnt);
        now = snum;
        while (now > 1) {
          printf("%d ", val[id[now]]);
          now = pred[now];
        }
        printf("\n");
        if (snum == k + 1) return 0;
      }
  }
}
