#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, k;
  cin >> n >> k;
  long long a[n + 5];
  long long i;
  for (i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n, greater<long long>());
  long long c[k + 5];
  for (i = 1; i <= k; i++) cin >> c[i];
  long long ans = n;
  long long fir = 1, las = n;
  while (fir <= las) {
    long long mid = (fir + las) / 2;
    long long f = 0;
    for (i = 0; i < n; i++) {
      long long s = (i / mid) + 1;
      if (s > c[a[i]]) f = 1;
    }
    if (f == 1)
      fir = mid + 1;
    else {
      ans = mid;
      las = mid - 1;
    }
  }
  cout << ans << "\n";
  vector<long long> v[ans];
  for (i = 0; i < n; i++) v[i % ans].push_back(a[i]);
  for (i = 0; i < ans; i++) {
    cout << v[i].size() << " ";
    for (auto &k : v[i]) cout << k << " ";
    cout << "\n";
  }
}
