#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n, k, maxi = 0, sum = 0;
  cin >> n >> k;
  long long int m[n], c[k];
  map<long long int, long long int> p;
  set<long long int> s;
  for (int i = 0; i < n; i++) {
    cin >> m[i];
    p[m[i]]++;
    s.insert(m[i]);
  }
  vector<long long int> v;
  for (auto it : s) v.push_back(it);
  for (int i = 0; i < k; i++) cin >> c[i];
  sort(m, m + n);
  for (int i = v.size() - 1; i >= 0; i--) {
    if (i == v.size() - 1)
      sum = p[v.back()];
    else
      sum += p[v[i]];
    maxi = max(maxi, (sum + c[v[i] - 1] - 1) / (c[v[i] - 1]));
  }
  vector<long long int> vec[maxi];
  cout << maxi << "\n";
  for (int i = 0; i < n; i++) vec[i % maxi].push_back(m[i]);
  for (int i = 0; i < maxi; i++) {
    cout << vec[i].size() << " ";
    for (int j = 0; j < vec[i].size(); j++) cout << vec[i][j] << " ";
    cout << "\n";
  }
  return 0;
}
