#include <bits/stdc++.h>
using namespace std;
int n, k;
int a[200005], c[200005];
int cur[200005];
vector<int> g[200005];
inline int read() {
  int x = 0;
  char ch = getchar();
  while (!isdigit(ch)) ch = getchar();
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return x;
}
int main() {
  n = read(), k = read();
  for (int i = 1; i <= n; ++i) a[i] = read();
  for (int i = 1; i <= k; ++i) c[i] = read();
  sort(a + 1, a + n + 1, greater<int>());
  for (int i = 1; i <= n; ++i) {
    int l = 1, r = n, tp, mp = n;
    while (l <= r) {
      tp = l + r >> 1;
      if (cur[tp] + 1 <= c[a[i]]) {
        mp = min(mp, tp);
        r = tp - 1;
      } else {
        l = tp + 1;
      }
    }
    ++cur[mp];
    g[mp].push_back(a[i]);
  }
  for (int o = n; o >= 1; --o)
    if (g[o].size()) {
      printf("%d\n", o);
      for (int i = 1; i <= o; ++i) {
        printf("%d", int(g[i].size()));
        for (auto v : g[i]) printf(" %d", v);
        putchar('\n');
      }
      break;
    }
  return 0;
}
