#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n), c(k);
  for (long long &i : a) cin >> i;
  for (long long &i : c) cin >> i;
  sort(a.rbegin(), a.rend());
  long long ans = 0;
  long long j = 0;
  long long tot = 0;
  for (long long i = k - 1; i >= 0; i--) {
    while (j < n and a[j] > i) j++, tot++;
    ans = max((tot + c[i] - 1) / c[i], ans);
  }
  vector<vector<long long>> test(ans);
  for (long long i = 0; i < n; i++) test[i % ans].push_back(a[i]);
  cout << ans << endl;
  for (auto it : test) {
    cout << it.size() << " ";
    for (auto i : it) cout << i << " ";
    cout << endl;
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false), cin.tie(nullptr), cin.tie(nullptr);
  long long t_c = 1;
  while (t_c--) solve();
}
