#include <bits/stdc++.h>
using namespace std;
bool ispow(long long n) { return (n & (n - 1)) == 0; }
const int mod = 1e9 + 7;
int a[200005], c[200005], num[200005];
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= k; i++) cin >> c[i];
  for (int i = 1; i <= n; i++) num[a[i]]++;
  int maxn = -1;
  for (int i = k; i >= 1; i--) {
    num[i] += num[i + 1];
    maxn = max(maxn, num[i] / c[i] + (num[i] % c[i] != 0));
  }
  cout << maxn << '\n';
  sort(a + 1, a + 1 + n);
  vector<int> ans[maxn + 1];
  for (int i = 1; i <= n; i++) {
    ans[i % maxn].push_back(a[i]);
  }
  for (int i = 0; i < maxn; i++) {
    cout << ans[i].size() << ' ';
    for (auto u : ans[i]) cout << u << ' ';
    cout << '\n';
  }
  return 0;
}
