#include <bits/stdc++.h>
using namespace std;
const int mx = 200050;
vector<vector<int> > vec;
vector<int> here[mx];
int arr[mx];
int give[mx];
int cnt[mx];
int ccnt[mx];
int main() {
  int n, k, i, j, p, q, le;
  scanf("%d %d", &n, &k);
  for (i = 1; i <= n; i++) scanf("%d", arr + i);
  sort(arr + 1, arr + n + 1);
  for (i = 1; i <= n; i++) {
    cnt[arr[i]]++;
  }
  int ans = 0;
  for (i = 1; i <= k; i++) {
    scanf("%d", give + i);
  }
  for (i = k; i >= 1; i--) {
    ccnt[i] = ccnt[i + 1] + cnt[i];
    p = (ccnt[i] + give[i] - 1) / give[i];
    ans = max(ans, p);
  }
  vec.resize(ans);
  p = 0;
  for (i = n; i >= 1; i--) {
    vec[p].push_back(arr[i]);
    p++;
    p = p % ans;
  }
  n = ans;
  printf("%d\n", n);
  for (i = 0; i < n; i++) {
    p = vec[i].size();
    printf("%d", p);
    for (j = 0; j < p; j++) printf(" %d", vec[i][j]);
    printf("\n");
  }
  return 0;
}
