#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
const int mod = 998244353;
int a[N], b[N], c[N];
vector<int> t[N];
int main() {
  int n, k;
  cin >> n >> k;
  memset(b, 0, sizeof(b));
  for (int i = 1; i <= n; i++) {
    scanf("%d", a + i);
    b[a[i]]++;
  }
  for (int i = 1; i <= k; i++) {
    scanf("%d", c + i);
  }
  b[k + 1] = 0;
  int ans = 1;
  for (int i = k; i >= 1; --i) {
    b[i] = b[i + 1] + b[i];
    ans = max(ans, (b[i] + c[i] - 1) / c[i]);
  }
  sort(a + 1, a + 1 + n);
  for (int i = 1; i <= n; i++) {
    t[(i - 1) % ans].push_back(a[i]);
  }
  cout << ans << endl;
  for (int i = 0; i < ans; i++) {
    printf("%d ", t[i].size());
    for (auto x : t[i]) printf("%d ", x);
    puts("");
  }
}
