#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ll MOD = 998244353;
const ll MAX = 2e5 + 1;
inline ll add(ll a, ll b) { return ((a % mod) + (b % mod)) % mod; }
inline ll sub(ll a, ll b) { return ((a % mod) - (b % mod) + mod) % mod; }
inline ll mul(ll a, ll b) { return ((a % mod) * (b % mod)) % mod; }
ll pwr(ll x, ll n) {
  if (!n) return 1;
  if (n & 1)
    return mul(x, pwr(mul(x, x), (n - 1) / 2));
  else
    return pwr(mul(x, x), n / 2);
}
ll modinv(ll n) { return pwr(n, mod - 2); }
ll n, k, a[MAX], c[MAX];
bool possible(ll x) {
  ll v[x], idx = 0;
  memset(v, 0, sizeof(v));
  for (ll i = 0; i < n; i++) {
    if (v[idx] < c[a[i] - 1]) {
      v[idx++]++;
      idx %= x;
    } else {
      return false;
    }
  }
  return true;
}
void speed_solve() {
  cin >> n >> k;
  for (ll i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (ll i = 0; i < k; i++) {
    cin >> c[i];
  }
  sort(a, a + n);
  reverse(a, a + n);
  ll lo = 1, hi = n, mid, ans;
  while (lo <= hi) {
    mid = lo + (hi - lo) / 2;
    if (possible(mid)) {
      hi = mid - 1;
      ans = mid;
    } else {
      lo = mid + 1;
    }
  }
  vector<ll> v[ans];
  ll idx = 0;
  for (ll i = 0; i < n; i++) {
    v[idx++].push_back(a[i]);
    idx %= ans;
  }
  cout << ans << "\n";
  for (ll i = 0; i < ans; i++) {
    cout << (ll)v[i].size() << " ";
    for (auto it : v[i]) {
      cout << it << " ";
    }
    cout << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ll test_cases = 1;
  for (ll i = 0; i < test_cases; i++) {
    speed_solve();
  }
  return 0;
}
