#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  for (; b; a %= b, swap(a, b))
    ;
  return a;
}
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
int main(void) {
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  int n, k;
  cin >> n >> k;
  vector<int> m(n), c(k + 1);
  for (int i = 0; i < n; i++) cin >> m[i];
  sort(m.rbegin(), m.rend());
  for (int i = 1; i <= k; i++) cin >> c[i];
  vector<vector<int>> ans(1);
  int id = 0;
  for (int i = 0; i < n; i++) {
    if (i == 0)
      ans[id].push_back(m[i]);
    else {
      if (c[m[i]] > c[m[i - 1]]) id = 0;
      if (ans[id].size() == c[m[i]]) id++;
      if (ans.size() == id) ans.push_back({});
      ans[id].push_back(m[i]);
    }
  }
  cout << ans.size() << "\n";
  for (auto &vec : ans) {
    cout << vec.size() << " ";
    for (auto to : vec) cout << to << " ";
    cout << "\n";
  }
}
