#include <bits/stdc++.h>
using namespace std;
int n, k, f[200001], c[200001], ans, s[200001];
vector<pair<int, int> > sol[200001];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    long long a;
    cin >> a;
    f[a]++;
  }
  for (int i = 1; i <= k; i++) cin >> c[i];
  for (int i = k; i >= 1; i--) {
    int j = max(n, k);
    int st = 1;
    int dr = max(n, k);
    while (st <= dr) {
      int mij = (st + dr) / 2;
      if (s[mij] < c[i]) {
        if (j > mij) j = mij;
        dr = mij - 1;
      } else
        st = mij + 1;
    }
    while (f[i]) {
      ans = max(ans, j);
      long long canput = min(f[i], c[i] - s[j]);
      if (canput > 0) {
        s[j] += canput;
        sol[j].push_back({i, canput});
        f[i] -= canput;
      }
      j++;
    }
  }
  cout << ans << '\n';
  for (int i = 1; i <= ans; i++) {
    cout << s[i] << " ";
    for (auto j : sol[i]) {
      long long nr = j.first;
      long long times = j.second;
      for (int l = 1; l <= times; l++) cout << nr << " ";
    }
    cout << '\n';
  }
  return 0;
}
