#include <bits/stdc++.h>
using namespace std;
const int MX = 2e5 + 5, INF = 1000000000;
int arr[MX], mx[MX], n, k;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (int i = 1; i <= k; i++) cin >> mx[i];
  sort(arr, arr + n, greater<int>());
  vector<vector<int>> ans;
  set<pair<int, int>, greater<pair<int, int>>> s;
  for (int i = 0; i < n; i++) {
    auto it = s.lower_bound({mx[arr[i]] - 1, k});
    if (it == s.end()) {
      ans.push_back({arr[i]});
      s.insert({1, ans.size() - 1});
    } else {
      pair<int, int> tmp = {it->first + 1, it->second};
      ans[it->second].push_back(arr[i]);
      s.erase(it);
      s.insert(tmp);
    }
  }
  cout << ans.size() << "\n";
  for (auto v : ans) {
    cout << v.size() << " ";
    for (auto u : v) cout << u << " ";
    cout << "\n";
  }
  return 0;
}
