#include <bits/stdc++.h>
using namespace std;
int main() {
  int t = 1;
  while (t--) {
    int n, k;
    cin >> n >> k;
    vector<int> v(n);
    int itr = 1;
    for (int& x : v) {
      cin >> x;
    }
    set<int> bag{0}, tmp;
    map<int, vector<int>> pep;
    for (int i = 0; i < n && bag.size() <= k; i++) {
      tmp = bag;
      for (auto x : tmp) {
        if (bag.find(x + v[i]) == bag.end()) {
          bag.insert(x + v[i]);
          pep[x + v[i]] = pep[x];
          pep[x + v[i]].push_back(v[i]);
        }
        if (bag.size() > k) break;
      }
    }
    pep.erase(pep.begin());
    for (auto& it : pep) {
      cout << it.second.size() << " ";
      for (auto& x : it.second) {
        cout << x << " ";
      }
      cout << "\n";
    }
  }
  cerr << "processor time: " << clock() / (double)CLOCKS_PER_SEC << "s    ";
  return 0;
}
