#include <bits/stdc++.h>
using namespace std;
long long c[200009];
int cnt[200009];
bool ok(int m, int k) {
  long long used = 0;
  for (int i = k; i > 0; i--) {
    used += cnt[i];
    if (used > c[i] * m) {
      return false;
    }
  }
  return true;
}
vector<int> ans[200009];
int taken[200009];
priority_queue<pair<int, int> > pq;
void getAnswer(int n, int m, int k) {
  int i, j;
  for (i = 0; i < m; i++) {
    pq.push({0, i});
  }
  for (i = k; i > 0; i--) {
    while (cnt[i]) {
      pair<int, int> u = pq.top();
      pq.pop();
      int x = u.first, y = u.second;
      ans[y].push_back(i);
      cnt[i]--;
      pq.push({u.first - 1, u.second});
    }
  }
}
int main() {
  int n, k, i, l, h, m, a;
  scanf("%d %d", &n, &k);
  for (i = 0; i < n; i++) {
    scanf("%d", &a);
    cnt[a]++;
  }
  for (i = 1; i <= k; i++) {
    scanf("%lld", &c[i]);
  }
  l = 1, h = n;
  while (l < h) {
    m = (l + h) / 2;
    if (ok(m, k)) {
      h = m;
    } else {
      l = m + 1;
    }
  }
  getAnswer(n, l, k);
  printf("%d\n", l);
  for (i = 0; i < l; i++) {
    printf("%d", ans[i].size());
    for (int j = 0; j < ans[i].size(); j++) {
      printf(" %d", ans[i][j]);
    }
    puts("");
  }
  return 0;
}
