#include <bits/stdc++.h>
using namespace std;
const int inf = 2e9;
const long long INF = 8e18;
const int maxn = 2e5 + 5;
int n, k, cnt;
int a[maxn], b[maxn], p[maxn], fp[maxn], num[maxn];
vector<int> zz[maxn];
inline void init() {
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) {
    int x;
    cin >> x;
    ++num[x];
  }
  for (int i = 1; i <= k; ++i) {
    int x;
    cin >> x;
    if (!p[x]) p[x] = ++cnt, fp[cnt] = x;
    a[cnt] += num[i];
    while (num[i]--) zz[cnt].push_back(i);
  }
  for (int i = 1; i <= cnt; ++i) b[i] = fp[i] - fp[i + 1];
  int x = 0;
  for (int i = cnt; i >= 1; --i) {
    if (!a[i])
      x += b[i];
    else
      b[i] += x, x = 0;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  init();
  vector<vector<int> > ans;
  vector<pair<int, int> > now, last;
  for (int i = cnt; i >= 1; --i) {
    if (!a[i]) continue;
    last.push_back({i, a[i]});
  }
  while (!last.empty()) {
    int val = 0, z = 0;
    vector<int> res;
    for (auto &x : last) {
      int id = x.first, w = x.second;
      val += b[id];
      b[id] += z;
      int mi = min(x.second, val);
      w -= mi;
      val -= mi;
      while (mi--) res.push_back(id);
      if (w)
        now.push_back({id, w}), z = 0;
      else
        z = b[id];
    }
    ans.push_back(res);
    last = now;
    now.clear();
  }
  cout << ans.size() << '\n';
  for (auto &x : ans) {
    cout << x.size() << ' ';
    for (auto y : x) {
      cout << zz[y].back() << ' ';
      zz[y].pop_back();
    }
    cout << '\n';
  }
  return 0;
}
