#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:36777216")
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < (n); i++) cin >> a[i];
  map<int, pair<long long, long long> > m;
  m[0] = make_pair(0, 0);
  for (int i = 0; i < (n); i++) {
    for (auto it = m.rbegin(); it != m.rend(); it++)
      if (m.find(it->first + a[i]) == m.end())
        m[it->first + a[i]] =
            make_pair((it->second.first | (1ll << i)), it->second.second + 1);
    if ((int)(m).size() - 1 >= k) {
      int p = 0;
      for (auto it = m.begin(); it != m.end() && p <= k; it++, p++) {
        if (it->second.second == 0) continue;
        cout << it->second.second << " ";
        for (int j = 0; j < (n); j++)
          if ((1ll << j) & it->second.first) cout << a[j] << " ";
        cout << "\n";
      }
      return 0;
    }
  }
}
