#include <bits/stdc++.h>
using namespace std;
long long n, k;
long long a[(long long)(2e5 + 10)], c[(long long)(2e5 + 10)];
long long solve() {
  cin >> n >> k;
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 1; i <= k; i++) cin >> c[i];
  sort(a, a + n, greater<long long>());
  priority_queue<pair<long long, long long>, vector<pair<long long, long long>>,
                 greater<pair<long long, long long>>>
      pq;
  vector<vector<long long>> store;
  long long idx = -1;
  for (long long it = 0; it < n; it++) {
    long long i = a[it];
    if (pq.empty() or pq.top().first >= c[i]) {
      idx++;
      store.push_back({i});
      pq.push({1, idx});
      continue;
    }
    pair<long long, long long> loc = pq.top();
    pq.pop();
    store[loc.second].push_back(i);
    loc.first++;
    pq.push(loc);
  }
  cout << store.size() << '\n';
  for (vector<long long> &v : store) {
    cout << v.size() << " ";
    for (long long &i : v) cout << i << " ";
    cout << '\n';
  }
  return 0;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin.tie(nullptr);
  long long t_c = 1;
  while (t_c--) {
    auto ans = solve();
  }
}
