#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, k, i;
  cin >> n >> k;
  int a[n], c[k + 1];
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 1; i < k + 1; i++) cin >> c[i];
  sort(a, a + n, greater<int>());
  int g = 0, ans = 0;
  for (i = k; i >= 1; i--) {
    while (g < n && a[g] == i) ++g;
    ans = max(ans, (g + c[i] - 1) / c[i]);
  }
  vector<vector<int>> res(ans);
  for (i = 0; i < n; i++) res[i % ans].push_back(a[i]);
  cout << ans << "\n";
  for (i = 0; i < ans; i++) {
    cout << (long long int)(res[i].size()) << " ";
    for (auto it : res[i]) cout << it << " ";
    cout << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
