#include <bits/stdc++.h>
using namespace std;
int m[200005], c[200005];
void solve() {
  int n, k;
  scanf("%d %d ", &n, &k);
  multiset<int> s;
  for (int i = 0; i < n; ++i) {
    scanf("%d ", &m[i]);
    s.insert(m[i]);
  }
  for (int i = 1; i <= k; ++i) {
    scanf("%d ", &c[i]);
  }
  vector<vector<int> > out;
  while (s.size() > 0) {
    vector<int> g;
    int num = 0;
    while (s.size() > 0) {
      if (c[1] < num + 1) {
        break;
      }
      int l = 1, r = k, mid;
      while (l < r) {
        mid = (l + r + 1) / 2;
        if (c[mid] >= num + 1) {
          l = mid;
        } else {
          r = mid - 1;
        }
      }
      auto it = s.lower_bound(l + 1);
      if (it == s.begin()) {
        break;
      }
      it = prev(it);
      g.push_back(*it);
      s.erase(it);
      ++num;
    }
    out.push_back(g);
  }
  printf("%d\n", out.size());
  for (int i = 0; i < out.size(); ++i) {
    printf("%d ", out[i].size());
    for (int ele : out[i]) {
      printf("%d ", ele);
    }
    putchar('\n');
  }
}
int main() {
  solve();
  return 0;
}
