#include <bits/stdc++.h>
using namespace std;
template <typename A>
using VE = vector<A>;
template <typename A>
using USET = unordered_set<A>;
template <typename A>
using HEAP = priority_queue<A>;
template <typename A, typename B>
using PA = pair<A, B>;
template <typename A, typename B>
using UMAP = unordered_map<A, B>;
template <typename A>
using RHEAP = priority_queue<A, vector<A>, greater<A> >;
const int N = 200010, M = 1010;
int n, k;
int a[N];
int cnt[N];
int c[N];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(10);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    cnt[a[i]]++;
  }
  for (int i = 1; i <= k; i++) cin >> c[i];
  long long s = 0;
  long long mx = 0;
  for (int i = k; i; i--) {
    s += cnt[i];
    mx = max(mx, (s + c[i] - 1) / c[i]);
  }
  VE<vector<int> > res(mx);
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= n; i++) res[i % mx].emplace_back(a[i]);
  cout << mx << '\n';
  for (auto &u : res) {
    cout << ((int)u.size()) << ' ';
    for (auto &v : u) cout << v << ' ';
    cout << '\n';
  }
  return 0;
}
