#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long int n, k;
  cin >> n >> k;
  vector<long long int> vec(n);
  for (int i = 0; i < n; i += 1) cin >> vec[i];
  sort(vec.begin(), vec.end(), greater<long long int>());
  vector<long long int> c(k + 1);
  for (int i = 1; i < k + 1; i += 1) cin >> c[i];
  map<long long int, vector<long long int> > cnt;
  map<long long int, vector<long long int> > num;
  long long int j = 0, minn = INT_MAX;
  for (int i = 0; i < n; i += 1) {
    if (cnt.size() == 0 || minn >= c[vec[i]]) {
      cnt[1].push_back(j);
      num[j].push_back(vec[i]);
      minn = min(minn, 1 * 1ll);
      j++;
    } else {
      long long int p = cnt[minn][cnt[minn].size() - 1];
      cnt[minn].pop_back();
      num[p].push_back(vec[i]);
      cnt[minn + 1].push_back(p);
      if (cnt[minn].size() == 0) minn += 1;
    }
  }
  map<long long int, vector<long long int> >::iterator it, it1;
  long long int ct = 0;
  for (it = cnt.begin(); it != cnt.end(); ++it) {
    ct += it->second.size();
  }
  cout << ct << endl;
  for (it = cnt.begin(); it != cnt.end(); ++it) {
    for (int i = 0; i < it->second.size(); i += 1) {
      if (it->first >= minn) {
        cout << it->first << " ";
        for (int j = 0; j < num[it->second[i]].size(); j += 1)
          cout << num[it->second[i]][j] << " ";
        cout << endl;
      }
    }
  }
}
