#include <bits/stdc++.h>
using namespace std;
long double eps = (long double)1 / 1e6;
long long inf = INT_MAX, mod2 = 998244353, mod1 = 1e9 + 7;
long long sqr(long long a) { return a * a; }
long long qb(long long a) { return a * a * a; }
long long gcd(long long a, long long b) { return !a ? b : gcd(b % a, a); }
long long binpow(long long a, long long b, long long mod) {
  return b ? (b % 2 ? (a * (sqr(binpow(a, b / 2, mod)) % mod)) % mod
                    : sqr(binpow(a, b / 2, mod)) % mod)
           : 1;
}
long long binmult(long long a, long long b, long long mod) {
  return b ? (b % 2 ? (2 * binmult(a, b / 2, mod) + a) % mod
                    : (2 * binmult(a, b / 2, mod)) % mod)
           : 0;
}
const long long R = 1e4;
const long long tx[4] = {0, 0, -1, 1};
const long long ty[4] = {-1, 1, 0, 0};
const char rev_to[4] = {'E', 'W', 'N', 'S'};
const long long N = 2 * 1e5 + 4;
signed main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(0);
  ;
  int n, k;
  cin >> n >> k;
  vector<long long> a(n);
  vector<long long> cnt(k, 0);
  for (auto &z : a) {
    cin >> z;
    z--;
    cnt[z]++;
  }
  vector<int> c(k);
  for (auto &z : c) cin >> z;
  sort(a.rbegin(), a.rend());
  for (int i = k - 2; i >= 0; i--) {
    cnt[i] += cnt[i + 1];
  }
  int ans = 0;
  int who;
  for (int i = 0; i < k; i++) {
    who = (cnt[i] % c[i] ? cnt[i] / c[i] + 1 : cnt[i] / c[i]);
    ans = max(ans, who);
  }
  vector<vector<int>> answ(ans, vector<int>());
  int prev = -1;
  int pos = 0;
  for (int i = 0; i < n; i++) {
    answ[i % ans].push_back(a[i]);
  }
  cout << (long long)answ.size() << "\n";
  for (auto &z : answ) {
    cout << (long long)z.size() << " ";
    for (auto g : z) cout << g + 1 << " ";
    cout << "\n";
  }
  return 0;
}
