#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long long LINF = 1e18;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  vector<int> tests(k + 1);
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    tests[a]++;
  }
  vector<int> v(k + 1);
  for (int i = 1; i < k + 1; i++) {
    cin >> v[i];
  }
  vector<vector<int> > res(1);
  int used = 0;
  int lastlast = 0;
  for (int i = k; i >= 1; i--) {
    int last = 0;
    if (res[0].size() == v[i]) {
      last = lastlast;
    }
    while (tests[i] != 0) {
      while (res[last].size() < v[i] && tests[i] != 0) {
        res[last].push_back(i);
        tests[i]--;
        used++;
      }
      lastlast = last;
      last++;
      if (last == res.size() && tests[i] != 0) {
        res.push_back(vector<int>());
      }
    }
  }
  if (res.back().size() == 0) res.pop_back();
  cout << res.size() << endl;
  for (int i = 0; i < res.size(); i++) {
    cout << res[i].size() << " ";
    for (int j = 0; j < res[i].size(); j++) {
      cout << res[i][j] << " ";
    }
    cout << endl;
  }
  return 0;
}
