#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
inline void mine(T1 &x, T2 y) {
  if (x > y) x = y;
}
template <typename T1, typename T2>
inline void maxe(T1 &x, T2 y) {
  if (x < y) x = y;
}
ostream &operator<<(ostream &a, const vector<long long> &b) {
  for (auto k : b) cout << k << ' ';
  return a;
}
const long long MOD = 1000000007;
const long long INF = 1000000050;
const long long BIG = (long long)2e18 + 50;
const long long MX = 200010;
const double EPS = 1e-9;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
long long cnt[MX];
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, k;
  cin >> n >> k;
  set<pair<long long, long long> > cur;
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    ++cnt[x];
  }
  for (long long i = 1; i < k + 1; i++) {
    if (cnt[i]) {
      cur.insert({i, cnt[i]});
    }
  }
  vector<pair<long long, long long> > can;
  can.push_back({1, 0});
  cin >> can[0].second;
  for (long long i = 2; i < k + 1; i++) {
    long long x;
    cin >> x;
    if (x != can.back().second) {
      can.push_back({i, x});
    } else {
      can.back().first = i;
    }
  }
  reverse(can.begin(), can.end());
  for (auto &x : can) swap(x.first, x.second);
  vector<vector<long long> > ans;
  while (!cur.empty()) {
    long long taken = 0;
    ans.push_back({});
    while (true) {
      auto it = lower_bound(can.begin(), can.end(), make_pair(taken + 1, 0ll));
      if (it == can.end()) break;
      long long x = it->second;
      auto it2 = cur.upper_bound(make_pair(x + 1, -1ll));
      if (it2 == cur.begin()) break;
      --it2;
      pair<long long, long long> val = *it2;
      ans.back().push_back(val.first);
      cur.erase(it2);
      if (val.second > 1) cur.insert({val.first, val.second - 1});
      ++taken;
    }
  }
  cout << ans.size() << '\n';
  for (long long i = 0; i < ans.size(); i++) {
    cout << ans[i].size();
    for (auto &x : ans[i]) cout << ' ' << x;
    cout << '\n';
  }
}
