#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using u64 = uint64_t;
using u32 = uint32_t;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vpi = vector<pi>;
static constexpr int INF = (int)1e9 + 5;
static constexpr ll INFL = (ll)1e18 + 5;
static mt19937 rng((u32)chrono::duration_cast<chrono::nanoseconds>(
                       chrono::high_resolution_clock::now().time_since_epoch())
                       .count());
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, k;
  cin >> n >> k;
  vi c(k), cnt(k);
  for (int i = 0; i < (n); ++i) {
    int mi;
    cin >> mi;
    cnt[mi - 1]++;
  }
  for (auto& ci : c) cin >> ci;
  c.push_back(0);
  vvi tc;
  int full = 0;
  for (int i = k - 1; i >= 0; --i) {
    int x = cnt[i];
    if (c[i] > c[i + 1]) full = 0;
    while (x > 0 && full < ((int)(tc).size())) {
      while (x > 0 && ((int)(tc[full]).size()) < c[i])
        tc[full].push_back(i + 1), --x;
      if (((int)(tc[full]).size()) == c[i]) ++full;
    }
    int add = (x + c[i] - 1) / c[i];
    tc.resize(((int)(tc).size()) + add);
    while (x > 0 && full < ((int)(tc).size())) {
      while (x > 0 && ((int)(tc[full]).size()) < c[i])
        tc[full].push_back(i + 1), --x;
      if (((int)(tc[full]).size()) == c[i]) ++full;
    }
  }
  cout << ((int)(tc).size()) << '\n';
  for (auto& tci : tc) {
    cout << ((int)(tci).size());
    for (auto& i : tci) cout << ' ' << i;
    cout << '\n';
  }
  return 0;
}
