#include <bits/stdc++.h>
using namespace std;
int n, k, a[200009], c[200009];
vector<int> v[200009];
set<pair<int, int> > s;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  ios_base::sync_with_stdio(0);
  cin >> n >> k;
  for (int i = 0, x; i < n; i++) {
    cin >> x;
    x--;
    a[x]++;
  }
  for (int i = 0; i < k; i++) {
    cin >> c[i];
  }
  s.insert({0, 0});
  int cur = 1;
  for (int i = k; i >= 0; i--) {
    while (a[i]) {
      auto it = s.begin();
      pair<int, int> p = *it;
      if (p.first == c[i]) break;
      s.erase(p);
      int x = p.second;
      while (p.first < c[i] && a[i] > 0) {
        p.first++;
        a[i]--;
        v[x].push_back(i + 1);
      }
      s.insert(p);
    }
    while (a[i]) {
      pair<int, int> p = {0, cur};
      p.first += min(a[i], c[i]);
      a[i] -= p.first;
      for (int j = 0; j < p.first; j++) v[cur].push_back(i + 1);
      s.insert(p);
      cur++;
    }
  }
  cout << cur << "\n";
  for (int i = 0; i < cur; i++) {
    cout << v[i].size() << " ";
    for (int j = 0; j < v[i].size(); j++) cout << v[i][j] << " ";
    cout << "\n";
  }
}
