#include <bits/stdc++.h>
using namespace std;
map<int, bool> g;
struct node {
  int x, y, z, num;
} ans[3000];
int a[60], sum[60], vis[60], flag, n, final, k;
int main() {
  int i, t = 0, s, j, num = 0, tt;
  flag = 0;
  final = 0;
  scanf("%d%d", &n, &k);
  g.clear();
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  ans[++t].z = 0;
  ans[t].x = 0;
  ans[t].y = 0;
  ans[t].num = 0;
  for (i = 1; i <= n; i++) {
    tt = t;
    for (j = 1; j <= tt; j++) {
      if (g[ans[j].z + a[i]] == false) {
        g[ans[j].z + a[i]] = true;
        ans[++t].z = ans[j].z + a[i];
        ans[t].y = a[i];
        ans[t].x = j;
        ans[t].num = ans[j].num + 1;
        num++;
        printf("%d", ans[t].num);
        s = t;
        while (1) {
          printf(" %d", ans[s].y);
          s = ans[s].x;
          if (s == 1) break;
        }
        printf("\n");
        if (num == k) break;
      }
    }
    if (num == k) break;
  }
  return 0;
}
