#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1000000009;
void solve() {
  int i, j, l, m, n, k, t;
  cin >> n >> k;
  int a[n + 1];
  a[0] = 0;
  for (i = 1; i <= n; i++) cin >> a[i];
  sort(a, a + n + 1);
  for (i = k; i >= 1; i--) {
    j = i;
    t = n;
    vector<int> temp;
    while (j > 0) {
      if (j >= t) {
        temp.push_back(a[t]);
        j -= t;
        t--;
      } else {
        temp.push_back(a[j]);
        j = 0;
      }
    }
    cout << temp.size() << " ";
    for (int x : temp) {
      cout << x << " ";
    }
    cout << "\n";
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
