#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
using namespace std;
const double PI = acos(-1.0);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const long long N = 2e5 + 10;
long long cnt[N];
long long c[N];
long long n, k;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  multiset<long long> se;
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    cnt[x]++;
    se.insert(x);
  }
  for (long long i = 1; i <= k; i++) {
    cin >> c[i];
  }
  long long cur = 0;
  long long used = 0;
  long long usable_per_testcase = 0;
  for (long long i = k; i >= 1; i--) {
    usable_per_testcase = c[i];
    while (cur * usable_per_testcase - used < cnt[i]) {
      cur++;
    }
    used += cnt[i];
  }
  cout << cur << "\n";
  vector<long long> ans[n + 5];
  long long c = 0;
  for (long long i : se) {
    ans[c].push_back(i);
    c = (c + 1) % cur;
  }
  for (long long i = 0; i < cur; i++) {
    cout << ans[i].size() << " ";
    for (auto x : ans[i]) {
      cout << x << " ";
    }
    cout << "\n";
  }
}
