#include <bits/stdc++.h>
using namespace std;
const int nax = 2e5 + 5;
int n, k;
int testcases_size[nax];
int max_number_per_size[nax];
int suffix_size[nax];
int counter_size[nax];
bool sorter2(const pair<long int, long int> &a,
             const pair<long int, long int> &b) {
  return (a.second < b.second);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> testcases_size[i];
    suffix_size[testcases_size[i]]++;
  }
  vector<pair<int, int> > testcases_per_size;
  if (suffix_size[k] != 0) {
    testcases_per_size.push_back(make_pair(k, suffix_size[k]));
  }
  cin >> max_number_per_size[1];
  for (int i = k - 1; i >= 1; i--) {
    if (suffix_size[i] != 0) {
      testcases_per_size.push_back(make_pair(i, suffix_size[i]));
    }
    suffix_size[i] += suffix_size[i + 1];
    cin >> max_number_per_size[k - i + 1];
  }
  int ans = 0;
  int cnt = 0;
  for (int i = k; i >= 1; i--) {
    int mid = ceil(suffix_size[i] / max_number_per_size[i]);
    if (suffix_size[i] % max_number_per_size[i] != 0) mid++;
    ans = max({ans, mid});
  }
  cout << ans << endl;
  sort(testcases_size + 1, testcases_size + n + 1);
  vector<vector<int> > res(ans);
  for (int i = 1; i <= n; i++) {
    res[(i - 1) % ans].push_back(testcases_size[i]);
  }
  for (int i = 0; i < int(ans); ++i) {
    printf("%d", int(res[i].size()));
    for (auto it : res[i]) printf(" %d", it);
    puts("");
  }
}
