#include <bits/stdc++.h>
using namespace std;
const int mx = 2e5 + 10;
const double PI = cos(-1.0);
int a[mx], c[mx];
vector<int> b[mx];
int cmp(int a, int b) { return a > b; }
int main() {
  int n, m, j = 1, ans = 0, l, r, lx, ly, mid;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= m; i++) scanf("%d", &c[i]);
  sort(a + 1, a + 1 + n, cmp);
  ans = 0;
  for (int i = 1; i <= n; i++) {
    l = 1, r = n;
    while (l < r) {
      mid = (l + r) / 2;
      int x = c[a[i]] - b[mid].size();
      if (x == 0) {
        l = mid + 1;
      } else
        r = mid;
    }
    b[l].push_back(a[i]);
    ans = max(ans, l);
  }
  printf("%d\n", ans);
  for (int i = 1; i <= ans; i++) {
    printf("%d ", b[i].size());
    for (int k = 0; k < b[i].size(); k++) {
      printf("%d ", b[i][k]);
    }
    printf("\n");
  }
  return 0;
}
