#include <bits/stdc++.h>
using namespace std;
long long powerm(long long x, unsigned long long y, long long p) {
  long long res = 1;
  x = x % p;
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
struct node {
  long long fmax = -10000000000000000;
  long long smax = -10000000000000000;
  long long sum = 0;
  long long value = 0;
};
vector<long long> v[200500];
long long visited[200500] = {0};
vector<node> vn;
void dfs(long long root, long long p) {
  if (visited[root] == 1) {
    return;
  }
  visited[root] = 1;
  long long sum = 0;
  for (long long i = 0; i < v[root].size(); i++) {
    long long child = v[root][i];
    if (child != p) {
      dfs(child, root);
      long long maxi = max(vn[child].fmax, vn[child].sum);
      if (vn[root].fmax < maxi) {
        vn[root].smax = vn[root].fmax;
        vn[root].fmax = maxi;
      } else if (vn[root].smax < maxi) {
        vn[root].smax = maxi;
      }
      sum += vn[child].sum;
    }
  }
  vn[root].sum = vn[root].value + sum;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  while (t--) {
    long long n, k;
    cin >> n >> k;
    long long a[n];
    for (long long i = 0; i < n; i++) {
      cin >> a[i];
      a[i] -= 1;
    }
    long long c[k];
    for (long long i = 0; i < k; i++) {
      cin >> c[i];
    }
    sort(a, a + n);
    long long m = 0;
    long long maxi = -1;
    for (long long i = n - 1; i >= 0; i--) {
      long long op = a[i];
      m += 1;
      long long s = (m + c[op] - 1) / c[op];
      maxi = max(s, maxi);
    }
    cout << maxi << "\n";
    vector<vector<long long>> answer(maxi);
    long long ok[n];
    for (long long i = 0; i < n; i++) {
      ok[i] = i % maxi;
      answer[ok[i]].push_back(a[i]);
    }
    for (long long i = 0; i < maxi; i++) {
      cout << answer[i].size() << " ";
      for (long long j = 0; j < answer[i].size(); j++) {
        cout << answer[i][j] + 1 << " ";
      }
      cout << "\n";
    }
  }
  return 0;
}
