#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int a[N], b[N];
int n, k, res, sz[N];
vector<int> ans[N];
int main() {
  ios ::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= k; i++) cin >> b[i];
  sort(a + 1, a + n + 1);
  reverse(a + 1, a + n + 1);
  res = 1;
  for (int i = 1; i <= n; i++) {
    int rem = b[a[i]];
    int l = 1, r = res;
    while (l < r) {
      int mid = l + r >> 1;
      if (rem > sz[mid])
        r = mid;
      else
        l = mid + 1;
    }
    if (r <= 0 || r > res || rem <= sz[r]) {
      res++;
      sz[res] = 1;
      ans[res].push_back(a[i]);
    } else {
      sz[r]++;
      ans[r].push_back(a[i]);
    }
  }
  cout << res << endl;
  for (int i = 1; i <= res; i++) {
    cout << ans[i].size() << " ";
    for (auto x : ans[i]) cout << x << " ";
    cout << endl;
  }
  return 0;
}
