#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const int arr = 200005;
int pow(long long int x, long long int y, long long int p) {
  if (y == 0) return 1;
  if (y == 1) return x;
  x = x % p;
  long long int ans = pow(x, y / 2, p) % p;
  ans = ans * ans % p;
  if (y % 2 == 0)
    return ans % mod;
  else
    return ans * x % mod;
}
void solve() {
  int n, k;
  cin >> n >> k;
  vector<int> m(n);
  for (int i = 0; i < n; i++) cin >> m[i];
  sort(m.begin(), m.end());
  ;
  int c[k];
  for (int i = 0; i < k; i++) cin >> c[i];
  vector<int> d(k, 0);
  for (int i = 0; i < n; i++) {
    d[m[i] - 1]++;
  }
  int ans = 1;
  int temp = 0;
  for (int i = k - 1; i >= 0; i--) {
    temp += d[i];
    if (temp / c[i] >= ans) {
      if (temp % c[i])
        ans = temp / c[i] + 1;
      else
        ans = temp / c[i];
    }
  }
  cout << ans << "\n";
  vector<vector<int> > ad(ans);
  for (int i = n - 1; i >= 0; i--) {
    ad[i % ans].push_back(m[i]);
  }
  for (int i = 0; i < ans; i++) {
    cout << ad[i].size() << " ";
    for (int j = 0; j < ad[i].size(); j++) {
      cout << ad[i][j] << " ";
    }
    cout << "\n";
  }
}
int main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(0);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
