#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e5 + 5;
template <class T>
void print(T& x) {
  cout << x;
}
template <class T, class U>
void print(pair<T, U>& p) {
  cout << "(";
  print(p.first);
  cout << ", ";
  print(p.second);
  cout << ")";
}
template <class T>
void print(vector<T>& v) {
  cout << "{";
  if (((int)(v).size())) print(v[0]);
  for (int i = 1; i < ((int)(v).size()); i++) cout << ", ", print(v[i]);
  cout << "}\n";
}
int n, m, k;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int k;
  cin >> n >> k;
  multiset<int> A;
  vector<int> num(k + 1);
  for (int i = 1, x; i <= n; ++i) {
    cin >> x;
    A.insert(x);
  }
  for (int i = 1; i <= k; ++i) {
    cin >> num[i];
  }
  vector<int> id(n + 1);
  sort(num.begin() + 1, num.end());
  for (int i = 0; i < n; ++i) {
    int pos = upper_bound(num.begin() + 1, num.end(), i) - num.begin();
    id[i] = k - pos + 1;
  }
  vector<vector<int>> ans;
  ans.push_back(vector<int>());
  while (!A.empty()) {
    int cur = id[((int)(ans.back()).size())];
    if (cur == 0) {
      ans.push_back(vector<int>());
      continue;
    }
    if (*A.begin() > cur) {
      ans.push_back(vector<int>());
      continue;
    } else {
      auto iter = A.lower_bound(cur);
      if (iter == A.end() || *iter != cur) iter--;
      ans.back().push_back(*iter);
      A.erase(iter);
    }
  }
  cout << ((int)(ans).size()) << endl;
  for (auto v : ans) {
    cout << ((int)(v).size()) << " ";
    for (auto x : v) cout << x << " ";
    cout << endl;
  }
  return 0;
}
