#include <bits/stdc++.h>
#pragma GCC optimize("Ofast", "unroll-loops", "omit-frame-pointer", "inline")
using namespace std;
const unsigned long long mod = 1000000007;
const long long inf = ((1ll << 31ll) - 1ll);
const long double pi = acos(-1);
const long long MAXN = 10000;
vector<long long> Criba(MAXN + 1);
void iniciar_criba() {
  for (long long i = 2; i <= MAXN; i += 2) Criba[i] = 2;
  for (long long i = 3; i <= MAXN; i += 2) {
    if (!Criba[i]) {
      Criba[i] = i;
      for (long long j = i * i; j <= MAXN; j += (2 * i))
        if (!Criba[j]) Criba[j] = i;
    }
  }
}
bool isprime(long long tupac) { return (Criba[tupac] == tupac); }
long long GCD(long long q, long long r) {
  if (r == 0) return q;
  return GCD(r, q % r);
}
long long LCM(long long q, long long r) { return q * (r / GCD(q, r)); }
long long qpow(long long b, long long e) {
  if (!e) return 1;
  if (e & 1) return qpow(b, e - 1) * b % mod;
  long long pwur = qpow(b, e >> 1);
  return pwur * pwur % mod;
}
long long Fibo[10000000];
void fibo() {
  Fibo[0] = 0;
  Fibo[1] = 1;
  long long i;
  for (i = 2; Fibo[i - 1] <= 1000000000; i++) {
    Fibo[i] = Fibo[i - 1] + Fibo[i - 2];
  }
}
long long nxt() {
  long long x;
  cin >> x;
  return x;
}
long long t, n, x, m, B[200007], C[200007], lB, rB;
long long sum;
bool Flag[104];
vector<pair<long long, long long> > z;
void problem() {
  long long k;
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) cin >> B[i];
  for (long long i = 1; i <= k; i++) cin >> C[i];
  sort(B + 1, B + n + 1);
  long long cont = 0, cant = 0, j = n;
  for (long long i = k; i >= 1; i--) {
    while (B[j] >= i && j != 0) {
      cont++;
      j--;
    }
    if ((cont + C[i] - 1) / C[i] > cant) cant = (cont + C[i] - 1) / C[i];
  }
  cout << cant << '\n';
  for (long long i = 1; i <= cant; i++) {
    long long tam = n / cant;
    if (i <= n % cant) tam++;
    cout << tam << ' ';
    for (j = 0; j < tam; j++) cout << B[i + j * cant] << ' ';
    cout << '\n';
  }
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.setf(ios::fixed);
  cout.precision(0);
  srand(time(NULL));
  t = 1;
  while (t--) {
    problem();
  }
  return 0;
}
