#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int>> P;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie();
  long long n, k, ok = 0;
  cin >> n >> k;
  long long arr[n];
  long long crr[k];
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (long long i = 0; i < k; i++) {
    cin >> crr[i];
  }
  if (ok == 0) {
    sort(arr, arr + n);
    pair<long long, long long> p;
    priority_queue<pair<long long, long long>> pq;
    priority_queue<pair<long long, long long>> pq2;
    for (long long i = 0; i < n; i++) {
      p = make_pair((-1 * (crr[arr[i] - 1])), arr[i]);
      pq.push(p);
    }
    map<long long, vector<long long>> mp;
    long long value1 = 0, value2 = 0, map_index = 0;
    long long q2_1 = 0, q2_2 = 0;
    while (!pq.empty()) {
      value1 = pq.top().first;
      if (value1 < 0) {
        value1 = (value1) * -1;
      }
      value2 = pq.top().second;
      pq.pop();
      if (pq2.size() == 0) {
        pq2.push({-1, map_index});
        mp[map_index].push_back(value2);
        map_index++;
      } else {
        q2_1 = pq2.top().first;
        q2_1 = (q2_1) * -1;
        q2_2 = pq2.top().second;
        if ((value1 - 1) >= q2_1) {
          pq2.pop();
          mp[q2_2].push_back(value2);
          pq2.push({(-1 * (q2_1 + 1)), q2_2});
        } else {
          pq2.push({-1, map_index});
          mp[map_index].push_back(value2);
          map_index++;
        }
      }
    }
    cout << (map_index) << "\n";
    for (long long i = 0; i < map_index; i++) {
      cout << mp[i].size() << " ";
      for (long long j = 0; j < mp[i].size(); j++) {
        cout << mp[i][j] << " ";
      }
      cout << "\n";
    }
  }
  return 0;
}
