#include <bits/stdc++.h>
using namespace std;
int a[100];
long long b[10000][100];
int main() {
  int n;
  int k;
  int u;
  while (scanf("%d%d", &n, &k) != EOF) {
    for (int i = 0; i < n; i++) scanf("%d", &a[i]);
    sort(a, a + n);
    int m = 0;
    for (int c = n; c > 0; c--) {
      for (int i = m; i < m + c; i++) {
        b[i][0] = n - c + 1;
      }
      m += c;
    }
    m = 0;
    int c = n;
    u = 0;
    for (c = n; c > 0; c--) {
      for (int i = m; i < m + c; i++) {
        b[i][1] = a[u];
        u++;
      }
      u = 0;
      m = m + c;
    }
    m = n - 1;
    c = n;
    u = n;
    for (int j = 2; j <= n; j++) {
      for (int i = c; i < n * (n + 1) / 2; i++) b[i][j] = a[u - 1];
      c += m;
      m--;
      u--;
    }
    for (int i = 0; i < k; i++) {
      if (i == k) break;
      for (int j = 0; j < b[i][0] + 1; j++) {
        if (b[i][j] != 0) {
          if (j == b[i][0])
            cout << b[i][j] << endl;
          else
            cout << b[i][j] << " ";
        }
      }
    }
  }
  return 0;
}
