#include <bits/stdc++.h>
using namespace std;
int tests[200000];
int cum_count[200000 + 1];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> tests[i];
    tests[i] = tests[i];
  }
  sort(tests, tests + n);
  int last = k + 1;
  cum_count[k + 1] = 0;
  for (int i = n - 1; i >= 0; i--) {
    for (int j = last - 1; j >= tests[i]; j--) {
      cum_count[j] = cum_count[last];
    }
    last = tests[i];
    cum_count[last]++;
  }
  int ans = -1;
  for (int j = 1; j <= k; j++) {
    int c;
    cin >> c;
    ans = max((cum_count[j] - 1) / c + 1, ans);
  }
  cout << ans << endl;
  for (int i = 0; i < ans; i++) {
    int c = 0;
    for (int j = i; j < n; j += ans) {
      c++;
    }
    cout << c << " ";
    for (int j = i; j < n; j += ans) {
      c++;
      cout << tests[j] << " ";
    }
    cout << endl;
  }
}
