#include <bits/stdc++.h>
using namespace std;
FILE *fi = fopen("file.in", "r");
FILE *fo = fopen("file.out", "w");
int cmp(void const *x, void const *y) {
  long a = *(long *)x;
  long b = *(long *)y;
  return a - b;
}
long n, m, k, l, i, j, t, a, b, c, d;
long x[100], s[100];
int main() {
  scanf("%ld %ld", &n, &m);
  for (i = 0; i < n; i++) scanf("%ld", &x[i]), s[i] = x[i];
  sort(x, x + n);
  sort(s, s + n);
  reverse(s, s + n);
  i = 0;
  l = 0;
  while (k < m) {
    printf("%ld", i + 1);
    for (j = 0; j < i; j++) printf(" %ld", s[j]);
    printf(" %ld", x[l++]);
    k++;
    if (l == n - i) {
      l = 0;
      i++;
    }
    printf("\n");
  }
  getchar();
  getchar();
}
