#include <bits/stdc++.h>
using namespace std;
const int N = 501010;
const int qwq = 303030;
const int inf = 0x3f3f3f3f;
const int mp = 998244353;
int n, K;
int a[N];
int c[N];
vector<int> d[N];
int siz[N];
int tot;
inline int read() {
  int sum1 = 0, ff = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') ff = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    sum1 = sum1 * 10 + c - '0';
    c = getchar();
  }
  return sum1 * ff;
}
int main() {
  n = read();
  K = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= K; i++) c[i] = read();
  siz[0] = inf;
  for (int i = n; i >= 1; i--) {
    if (siz[tot] >= c[a[i]]) {
      siz[++tot] = 1;
      d[tot].push_back(a[i]);
      continue;
    }
    int l = 1, r = tot, mid, wei;
    while (l <= r) {
      mid = l + r >> 1;
      if (siz[mid] < c[a[i]])
        wei = mid, r = mid - 1;
      else
        l = mid + 1;
    }
    siz[wei]++;
    d[wei].push_back(a[i]);
  }
  cout << tot << "\n";
  for (int i = 1; i <= tot; i++) {
    cout << siz[i] << " ";
    for (int j = 0; j < siz[i]; j++) cout << d[i][j] << " ";
    cout << "\n";
  }
  return 0;
}
