#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);
  vector<int> c(k);
  for (auto &it : m) cin >> it;
  for (auto &it : c) cin >> it;
  sort(m.rbegin(), m.rend());
  int cur = 0;
  int ans_cnt = 0;
  for (int i = k; i > 0; --i) {
    while (cur < n && m[cur] >= i) {
      cur += 1;
    }
    ans_cnt = max(ans_cnt, (c[i - 1] + cur - 1) / c[i - 1]);
  }
  vector<vector<int> > ans(ans_cnt);
  for (int i = 0; i < n; ++i) {
    ans[i % ans_cnt].push_back(m[i]);
  }
  cout << ans.size() << endl;
  for (size_t i = 0; i < ans.size(); ++i) {
    cout << ans[i].size();
    for (size_t j = 0; j < ans[i].size(); ++j) {
      cout << " " << ans[i][j];
    }
    cout << endl;
  }
}
