#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int n, k;
  cin >> n >> k;
  vector<long long> kol(k, 0);
  for (int i = 0; i < n; i++) {
    int m;
    cin >> m;
    m--;
    kol[m]++;
  }
  vector<long long> suf(k, 0);
  suf[k - 1] = kol[k - 1];
  for (int i = k - 2; i >= 0; i--) {
    suf[i] = suf[i + 1] + kol[i];
  }
  vector<long long> c(k);
  for (int i = 0; i < k; i++) {
    cin >> c[i];
  }
  long long mx = 0;
  for (int i = k - 1; i >= 0; i--) {
    mx = max(mx, (suf[i] + c[i] - 1) / c[i]);
  }
  cout << mx << "\n";
  vector<vector<int>> ans(mx);
  int itr = 0;
  for (int i = k - 1; i >= 0; i--) {
    while (kol[i]-- > 0) {
      ans[itr++].push_back(i + 1);
      itr %= mx;
    }
  }
  for (auto& v : ans) {
    cout << v.size() << ' ';
    for (int value : v) {
      cout << value << ' ';
    }
    cout << '\n';
  }
}
