#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n, k, ans;
int m[N], c[N], cnt[N], sp[N], top;
multiset<int> S[N];
multiset<int>::iterator it;
bool check(int x) {
  for (int i = 1; i <= n; i++) S[i].clear();
  for (int i = 1; i <= n; i++) sp[i] = c[1];
  int mx = 1, t = 0;
  ans = 0;
  for (int i = 1; i <= top; i++) {
    for (int j = 1; j <= cnt[i]; j++) {
      t++;
      t = t % x;
      if (t == 0) t = x;
      int cnt = 0;
      while (cnt <= x && sp[t] <= 0) {
        cnt++;
        t++;
        t = t % x;
        if (t == 0) t = x;
      }
      sp[t] = min(sp[t] - 1, c[i] - 1);
      if (cnt > x) return 0;
      S[t].insert(i);
    }
  }
  return 1;
}
void output(int x) {
  printf("%d\n", x);
  for (int i = 1; i <= x; i++) {
    printf("%d ", S[i].size());
    for (it = S[i].begin(); it != S[i].end(); it++) printf("%d ", *it);
    printf("\n");
  }
}
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &m[i]);
    cnt[m[i]]++;
    top = max(top, m[i]);
  }
  for (int i = 1; i <= k; i++) {
    scanf("%d", &c[i]);
  }
  int l = 1, r = N;
  while (l < r) {
    int mid = (l + r) / 2;
    if (check(mid))
      r = mid;
    else
      l = mid + 1;
  }
  check(l);
  output(l);
  return 0;
}
