#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  vector<int> m(n);
  for (int i = 0; i < (int)n; i++) cin >> m[i];
  vector<int> c(k);
  for (int i = 0; i < (int)k; i++) cin >> c[i];
  sort(m.begin(), m.end());
  vector<int> g(k);
  int ans = 0;
  for (int i = 0; i < (int)k; i++) {
    auto it = lower_bound(m.begin(), m.end(), i + 1);
    g[i] = m.end() - it;
    ans = max(ans, (g[i] + c[i] - 1) / c[i]);
  }
  cout << ans << endl;
  vector<vector<int> > otv(ans);
  for (int i = 0; i < (int)n; i++) {
    otv[i % ans].push_back(m[i]);
  }
  for (int i = 0; i < (int)ans; i++) {
    cout << otv[i].size() << " ";
    for (auto it : otv[i]) cout << it << " ";
    cout << endl;
  }
  return 0;
}
