#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
const int N = 200005;
int n, k;
int ara[N], support[N];
int cnt[N], done[N];
vector<int> Ar[N];
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> ara[i];
  for (int i = 1; i <= k; i++) cin >> support[i];
  sort(ara + 1, ara + n + 1);
  int MX = 0;
  for (int i = n; i >= 1; i--) {
    int lo = 1, hi = n, mid, ans;
    while (lo <= hi) {
      mid = (lo + hi) / 2;
      if (done[mid] < support[ara[i]]) {
        ans = mid;
        hi = mid - 1;
      } else {
        lo = mid + 1;
      }
    }
    Ar[ans].push_back(ara[i]);
    done[ans]++;
    MX = max(MX, ans);
  }
  cout << MX << "\n";
  for (int i = 1; i <= MX; i++) {
    cout << Ar[i].size();
    for (int j : Ar[i]) cout << " " << j;
    cout << endl;
  }
}
