#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 200100;
const long long INF = 1000000000000000000;
int q[MAX_N], c[MAX_N], pref[MAX_N];
vector<int> test[MAX_N];
set<pair<int, int> > testOrder;
set<pair<int, int> >::iterator itBuff[MAX_N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  for (int i = 0; i < MAX_N; i++) {
    q[i] = 0;
    pref[i] = 0;
    test[i].clear();
  }
  int n, k;
  cin >> n >> k;
  for (int i = 0, j; i < n; i++) {
    cin >> j;
    q[j]++;
  }
  for (int i = 1; i <= k; i++) {
    cin >> c[i];
  }
  for (int i = k; i >= 1; i--) {
    pref[i] = pref[i + 1] + q[i];
  }
  int ans = 0;
  for (int i = 1; i <= k; i++) {
    int l = pref[i] / c[i] + (pref[i] % c[i] != 0);
    ans = max(ans, l);
  }
  if (ans == 0) {
    cout << ans << "\n";
    return 0;
  }
  for (int i = 0; i < ans; i++) {
    testOrder.insert(pair<int, int>(0, i));
  }
  for (int i = k; i >= 1; i--) {
    int bsz = 0, r = q[i] % ans;
    for (set<pair<int, int> >::iterator it = testOrder.begin();
         it != testOrder.end() && r; it++) {
      test[it->second].push_back(i);
      itBuff[bsz++] = it;
      r--;
    }
    for (int j = 0; j < bsz; j++) {
      pair<int, int> p = *itBuff[j];
      testOrder.erase(itBuff[j]);
      p.first++;
      testOrder.insert(p);
    }
    bsz = 0;
    int l = q[i] / ans;
    if (l == 0) continue;
    for (set<pair<int, int> >::iterator it = testOrder.begin();
         it != testOrder.end() && c[i] >= it->first + l; it++) {
      for (int z = 0; z < l; z++) {
        test[it->second].push_back(i);
      }
      itBuff[bsz++] = it;
    }
    for (int j = 0; j < bsz; j++) {
      pair<int, int> p = *itBuff[j];
      testOrder.erase(itBuff[j]);
      p.first += l;
      testOrder.insert(p);
    }
  }
  cout << ans << "\n";
  for (int i = 0; i < ans; i++) {
    cout << test[i].size() << " ";
    for (auto j : test[i]) {
      cout << j << " ";
    }
    cout << "\n";
  }
  return 0;
}
