#include <bits/stdc++.h>
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long int exp(long long int x, long long int y, long long int mod) {
  long long int res = 1;
  x = x % mod;
  while (y > 0) {
    if (y & 1) res = (res * x) % mod;
    y = y >> 1;
    x = (x * x) % mod;
  }
  return res;
}
long long int modinverse(long long int x, long long int mod) {
  return exp(x, mod - 2, mod);
}
using namespace std;
const long long int inf = 0x3f3f3f3f3f3f3f3fll;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long int n, x, m, c = 0;
  cin >> n >> m;
  vector<long long int> v(n);
  vector<long long int> ans[n * (n + 1) / 2];
  for (long long int i = 0; i < n; i++) cin >> v[i];
  sort(v.begin(), v.end());
  for (long long int i = 0; i < n; i++) {
    ans[c].push_back(v[i]);
    c++;
    for (long long int j = n - 1; j > i; j--) {
      ans[c].push_back(v[i]);
      for (long long int k = n - 1; k >= j; k--) ans[c].push_back(v[k]);
      c++;
    }
  }
  for (long long int i = 0; i < m; i++) {
    cout << ans[i].size() << " ";
    for (long long int j = 0; j < ans[i].size(); j++) cout << ans[i][j] << " ";
    cout << '\n';
  }
  return 0;
}
