#include <bits/stdc++.h>
using namespace std;
int mpow(int base, int exp);
void ipgraph(int m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
vector<int> g[N];
int a[N];
int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((long long)result * base) % mod;
    base = ((long long)base * base) % mod;
    exp >>= 1;
  }
  return result;
}
void ipgraph(int n, int m) {
  int i, u, v;
  while (m--) {
    cin >> u >> v;
    g[u - 1].push_back(v - 1);
    g[v - 1].push_back(u - 1);
  }
}
void dfs(int u, int par) {
  for (int v : g[u]) {
    if (v == par) continue;
    dfs(v, u);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t, i, j, k, p, q, r, x, y, u, v, n, m;
  cin >> n >> k;
  map<int, int> m1;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    m1[a[i]]++;
  }
  int cons[k + 1];
  for (i = 1; 1 < k + 1 ? i < k + 1 : i > k + 1; 1 < k + 1 ? i += 1 : i -= 1)
    cin >> cons[i];
  long long cnt = 0;
  long long groups = 0;
  for (i = k; k < 0 ? i < 0 : i > 0; k < 0 ? i += 1 : i -= 1) {
    cnt += m1[i];
    groups = max(groups, cnt / cons[i] + (cnt % cons[i] > 0 ? 1 : 0));
  }
  vector<vector<int>> ans(groups, vector<int>());
  priority_queue<pair<int, int>> Q;
  for (i = 0; i < groups; i++) Q.push({0, i});
  for (i = k; k < 0 ? i < 0 : i > 0; k < 0 ? i += 1 : i -= 1) {
    while (!Q.empty() && m1[i]) {
      j = Q.top().second;
      Q.pop();
      x = min(m1[i], cons[i] - int(ans[j].size()));
      m1[i] -= x;
      for (y = 0; y < x; y++) ans[j].push_back(i);
      Q.push({-int(ans[j].size()), j});
    }
  }
  cout << groups << endl;
  for (i = 0; i < ans.size(); i++) {
    cout << ans[i].size() << " ";
    for (j = 0; j < ans[i].size(); j++) cout << ans[i][j] << " ";
    cout << endl;
  }
  return 0;
}
