#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1e5 + 7;
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  int col[k + 1], h[k + 1];
  fill(col, col + k + 1, 0);
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    col[x]++;
  }
  for (int i = 1; i < k + 1; ++i) {
    cin >> h[i];
  }
  int sum = 0;
  int sz = 0;
  for (int j = k; j > 0; --j) {
    sum += col[j];
    if (sum % h[j] == 0)
      sz = max(sz, sum / h[j]);
    else
      sz = max(sz, sum / h[j] + 1);
  }
  int put[sz];
  fill(put, put + sz, 0);
  vector<int> ans[sz];
  int cur = 0;
  for (int i = k; i > 0; --i) {
    while (col[i] > 0) {
      int have = h[i] - put[cur];
      if (have < col[i]) {
        col[i] -= have;
        put[cur] += have;
        for (int j = 0; j < have; ++j) {
          ans[cur].push_back(i);
        }
        cur++;
        cur %= sz;
      } else {
        put[cur] += col[i];
        for (int j = 0; j < col[i]; ++j) {
          ans[cur].push_back(i);
        }
        col[i] = 0;
      }
    }
  }
  cout << sz << endl;
  for (int i = 0; i < sz; ++i) {
    cout << ans[i].size() << " ";
    for (int j = 0; j < ans[i].size(); ++j) {
      cout << ans[i][j] << " ";
    }
    cout << endl;
  }
}
