#include <bits/stdc++.h>
using namespace std;
template <class T, class L>
inline bool smax(T &x, L y) {
  return x < y ? (x = y, 1) : 0;
}
template <class T, class L>
inline bool smin(T &x, L y) {
  return y < x ? (x = y, 1) : 0;
}
const int maxn = 1e2 + 17;
unordered_map<int, int> par;
int n, k, a[maxn];
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  par.reserve(1 << 12);
  par[0] = -1;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (par.size() > k) continue;
    vector<int> mine;
    for (auto t : par)
      if (!par.count(t.first + a[i])) mine.push_back(t.first + a[i]);
    for (auto x : mine) par[x] = a[i];
  }
  par.erase(0);
  for (auto t : par) {
    if (k-- == 0) return 0;
    vector<int> v;
    for (int x = t.first; x; x -= par[x]) v.push_back(par[x]);
    cout << v.size() << ' ';
    for (auto x : v) cout << x << ' ';
    cout << '\n';
  }
  return 0;
}
