#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  while (t--) {
    int n, k;
    cin >> n >> k;
    vector<int> m(n), c(k + 1), cnt(k + 1, 0);
    for (int i = 0; i < n; i++) {
      cin >> m[i];
      cnt[m[i]]++;
    }
    for (int i = 1; i <= k; i++) cin >> c[i];
    for (int i = k - 1; i >= 1; i--) cnt[i] += cnt[i + 1];
    sort(m.begin(), m.end());
    int x, mx = 0;
    for (int i = 1; i <= k; i++) {
      x = cnt[i] / c[i];
      if (cnt[i] % c[i] != 0) x++;
      mx = max(x, mx);
    }
    cout << mx << '\n';
    vector<vector<int> > ans(mx);
    int j = 0;
    for (int i = n - 1; i >= 0; i--) {
      ans[j].push_back(m[i]);
      j = (j + 1) % mx;
    }
    for (int i = 0; i < mx; i++) {
      cout << ans[i].size() << " ";
      for (auto x : ans[i]) cout << x << " ";
      cout << '\n';
    }
  }
}
