#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int maxn = 2e5 + 7;
int n, k;
int m[maxn], a[maxn];
long long sum[maxn];
int vis[maxn];
struct node {
  int l, r, w;
  long long v;
} T[maxn];
int l = 1, cnt = 0;
vector<int> g[maxn];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= k; i++) scanf("%d", &m[i]);
  sort(a + 1, a + 1 + n);
  for (int i = 1; i <= k; i++) {
    if (m[i] != m[i + 1]) {
      cnt++;
      T[cnt].l = l;
      T[cnt].r = i;
      T[cnt].v = m[i];
      l = i + 1;
    }
  }
  int cur = 1;
  for (int i = 1; i <= n; i++) {
    while (1) {
      if (T[cur].l <= a[i] && T[cur].r >= a[i]) {
        T[cur].w++;
        break;
      } else
        cur++;
    }
  }
  long long maxk = 0;
  for (int i = cnt; i >= 1; i--) {
    sum[i] = T[i].w + sum[i + 1];
  }
  for (int i = cnt; i >= 1; i--) {
    if (sum[i] > maxk * T[i].v) {
      maxk = (sum[i] - 1) / T[i].v + 1;
    }
  }
  cout << maxk << endl;
  ;
  for (int i = 1; i <= n; i++) {
    g[i % maxk + 1].push_back(a[i]);
  }
  for (int i = 1; i <= maxk; i++) {
    printf("%d ", g[i].size());
    for (int j = 0; j < g[i].size(); j++) printf("%d ", g[i][j]);
    cout << endl;
  }
  return 0;
}
