#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int>> arrs;
vector<int> cs;
vector<vector<int>> ans;
priority_queue<pair<int, pair<int, int>>> store;
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++) {
    int siz;
    scanf("%d", &siz);
    arrs.push_back({siz, i});
  }
  sort(arrs.rbegin(), arrs.rend());
  for (int i = 0; i < k; i++) {
    int x;
    scanf("%d", &x);
    cs.push_back(x);
  }
  reverse(cs.begin(), cs.end());
  for (int i = 0; i < arrs.size(); i++) {
    int value = arrs[i].first;
    int idx = arrs[i].second;
    if (store.size() == 0 || store.top().first < value) {
      ans.push_back({});
      store.push({k, {0, ans.size() - 1}});
    }
    auto chosen = store.top();
    store.pop();
    ans[chosen.second.second].push_back(value);
    chosen.second.first++;
    auto it = upper_bound(cs.begin(), cs.end(), chosen.second.first);
    if (it != cs.end()) {
      chosen.first = k - (it - cs.begin());
      store.push(chosen);
    }
  }
  printf("%d\n", ans.size());
  for (int i = 0; i < ans.size(); i++) {
    printf("%d ", ans[i].size());
    for (int j = 0; j < ans[i].size(); j++) {
      if (j > 0) printf(" ");
      printf("%d", ans[i][j]);
    }
    printf("\n");
  }
  return 0;
}
