#include <bits/stdc++.h>
using namespace std;
const int MAXR = 65536;
char buf[MAXR], *lim = buf + MAXR - 1, *now = lim + 1;
bool adapt() {
  while (now <= lim && !isdigit(*now)) ++now;
  if (now > lim) {
    int r = fread(buf, 1, MAXR - 1, stdin);
    buf[r] = 0;
    lim = buf + r - 1;
    if (r == MAXR - 1) {
      while (isdigit(*lim)) ungetc(*lim--, stdin);
      if (*lim == '-') ungetc(*lim--, stdin);
    }
    now = buf;
  }
  while (now <= lim && !isdigit(*now)) ++now;
  return now <= lim;
}
bool readint(int& n) {
  if (!adapt()) return false;
  bool ngtv = *(now - 1) == '-';
  for (n = 0; isdigit(*now); n = ((n << 3) + (n << 1)) + *now++ - '0')
    ;
  if (ngtv) n = -n;
  return true;
}
int A[51];
bool _cond(int a, int b) {
  if (a < b) return false;
  return true;
}
int main() {
  int n, k, i, j, s, f;
  readint(n);
  readint(k);
  for (i = 0; i < n; ++i) readint(A[i]);
  sort(A, A + n, _cond);
  if (k <= n) {
    for (i = 0; i < k; ++i) printf("1 %d\n", A[i]);
  } else {
    for (i = 0; i < n; ++i) printf("1 %d\n", A[i]);
    s = n;
    f = i = 1;
    while (s < k) {
      printf("%d", f + 1);
      for (j = 0; j < f; ++j) {
        printf(" %d", A[j]);
      }
      printf(" %d\n", A[i++]);
      s++;
      if (s >= k) return 0;
      if (i == n) {
        f++;
        i = f;
      }
    }
  }
  return 0;
}
