#include <bits/stdc++.h>
using namespace std;
void sol() {
  long long int n, k, i;
  cin >> n >> k;
  vector<vector<long long int> > vc(n);
  vector<long long int> a(n);
  {
    for (long long int _i = 0; _i < n; _i++) {
      cin >> a[_i];
    }
  };
  long long int c[k + 1];
  for (i = 1; i <= k; i++) cin >> c[i];
  sort(a.begin(), a.end());
  long long int j = n - 1, ii = 0;
  long long int ma = -1;
  for (i = k; i > 0 && j >= 0; i--) {
    if (i == k || c[i] != c[i + 1]) ii = 0;
    while (j >= 0 && a[j] >= i) {
      if (int(vc[ii].size()) == c[i])
        ii++;
      else {
        vc[ii].push_back(a[j]);
        j--;
      }
      ma = max(ii, ma);
    }
  }
  cout << ma + 1;
  cout << "\n";
  for (i = 0; i < ma + 1; i++) {
    cout << int(vc[i].size()) << " ";
    {
      for (auto _i : vc[i]) {
        cout << _i << " ";
      }
      cout << "\n";
    };
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  while (t--) sol();
}
