#include <bits/stdc++.h>
using namespace std;
void ASS(bool bb) {
  if (!bb) {
    ++*(int *)0;
  }
}
#pragma comment(linker, "/STACK:106777216")
int n, k;
int a[64];
int Sum(long long x) {
  int res = 0;
  for (int i = 0; i < (int)(n); ++i)
    if ((x >> i) & 1) res += a[i];
  return res;
}
map<int, long long> d;
queue<long long> q;
void Add(long long x) {
  int sum = Sum(x);
  long long &t = d[sum];
  if (t) return;
  t = x;
  q.push(x);
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < (int)(n); ++i) {
    cin >> a[i];
    Add(1LL << i);
  }
  while (d.size() < k && !q.empty()) {
    long long x = q.front();
    q.pop();
    for (int i = 0; i < (int)(n); ++i) Add(x | (1LL << i));
  }
  ASS(d.size() >= k);
  map<int, long long>::iterator it = d.begin();
  for (int z = 0; z < (int)(k); ++z) {
    long long x = it->second;
    int c = 0;
    for (int i = 0; i < (int)(n); ++i)
      if ((x >> i) & 1) c++;
    cout << c;
    for (int i = 0; i < (int)(n); ++i)
      if ((x >> i) & 1) cout << " " << a[i];
    cout << endl;
    ++it;
  }
  return 0;
}
