#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, k;
  cin >> n >> k;
  long long m[n], c[k];
  map<long long, long long> mp;
  for (long long i = 0; i < n; i++) cin >> m[i];
  for (long long i = 0; i < k; i++) cin >> c[i];
  sort(m, m + n);
  long long maxm = 0;
  for (long long i = 0; i < n; i++) {
    maxm = max(maxm, (long long)ceil((double)(n - i) / (double)(c[m[i] - 1])));
  }
  vector<long long> ans[maxm];
  cout << maxm << endl;
  for (long long i = 0; i < n; i++) {
    ans[i % maxm].push_back(m[i]);
  }
  for (long long i = 0; i < maxm; i++) {
    cout << ans[i].size() << " ";
    for (long long V : ans[i]) cout << V << " ";
    cout << endl;
  }
}
