#include <bits/stdc++.h>
using namespace std;
long long int h[400005];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int n, m;
  cin >> n >> m;
  long long int a[n], b[m];
  for (long long int i = 0; i < n; i++) cin >> a[i];
  for (long long int i = 1; i <= m; i++) {
    long long int x;
    cin >> x;
    h[i] = x;
  }
  sort(a, a + n);
  long long int ans = 1, cnt = 0;
  for (long long int i = n - 1; i >= 0; i--) {
    cnt++;
    ans = max(ans, (cnt + h[a[i]] - 1) / h[a[i]]);
  }
  cout << ans << '\n';
  vector<long long int> v[ans + 5];
  long long int d = n / ans;
  long long int ind = n - 1;
  for (long long int j = 0; j < d; j++) {
    for (long long int i = 0; i < ans; i++) v[i].push_back(a[ind--]);
  }
  d = n % ans;
  d = 0;
  while (ind >= 0) v[d++].push_back(a[ind--]);
  for (long long int i = 0; i < ans; i++) {
    cout << v[i].size() << ' ';
    for (long long int j = 0; j < v[i].size(); j++) cout << v[i][j] << ' ';
    cout << '\n';
  }
  cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
}
