#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long infinity = 1000000000000000000;
bool do_debug = false;
struct sent {
  vector<bool> states;
  int sum;
};
void solve() {
  int n, k;
  cin >> n >> k;
  vector<int> v(n);
  vector<bool> incl(n, true);
  vector<sent> table(k);
  set<int> track;
  for (long long i = 0; i < n; i++) {
    cin >> v[i];
  }
  table[0].states = vector<bool>(n);
  for (long long i = 0; i < n; i++) {
    table[0].states[i] = incl[i];
    table[0].sum += v[i];
  }
  track.insert(table[0].sum);
  int added = 1;
  int ptr = 0;
  while (added < k) {
    for (long long i = 0; i < n; i++) {
      int ss = 0;
      if (table[ptr].states[i] == false) {
        continue;
      }
      if (track.find(table[ptr].sum - v[i]) != track.end()) {
        continue;
      }
      ss = table[ptr].sum - v[i];
      table[ptr].states[i] = false;
      table[added].states = vector<bool>(n);
      for (long long j = 0; j < n; j++) {
        table[added].states[j] = table[ptr].states[j];
      }
      table[ptr].states[i] = true;
      table[added].sum = ss;
      track.insert(ss);
      added++;
      if (added >= k) {
        break;
      }
    }
    ptr++;
  }
  for (long long i = 0; i < k; i++) {
    int c = 0;
    for (long long j = 0; j < n; j++) {
      if (table[i].states[j]) {
        c++;
      }
    }
    cout << c << " ";
    for (long long j = 0; j < n; j++) {
      if (table[i].states[j]) {
        cout << v[j] << " ";
      }
    }
    cout << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int q = 1;
  while (q-- > 0) {
    solve();
  }
  return 0;
}
