#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 20;
const int oo = 1e9;
bool cmp(int a, int b) { return a > b; }
int arr[N], cond[N], curr[N];
vector<int> ans[N];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; ++i) scanf("%d", arr + i);
  sort(arr, arr + n, cmp);
  for (int i = 0; i < k; ++i) scanf("%d", cond + i);
  int sz = 0;
  for (int i = 0; i < n; ++i) {
    int it = lower_bound(curr, curr + sz, arr[i]) - curr;
    if (it >= sz) sz++;
    ans[it].push_back(arr[i]);
    int sit = lower_bound(cond, cond + k, (int)ans[it].size(), cmp) - cond;
    curr[it] = sit;
  }
  printf("%d\n", sz);
  for (int i = 0; i < sz; ++i) {
    printf("%d ", ans[i].size());
    for (int it : ans[i]) printf("%d ", it);
    printf("\n");
  }
  return 0;
}
