#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
template <class T>
void chmin(T &a, const T &b) {
  if (a > b) a = b;
}
template <class T>
void chmax(T &a, const T &b) {
  if (a < b) a = b;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  for (int i = 0; i < (N); ++i) cin >> A[i];
  vector<int> C(K);
  for (int i = 0; i < (K); ++i) cin >> C[i];
  for (int i = 0; i < (N); ++i) A[i]--;
  vector<int> cnt(K, 0);
  for (int i = 0; i < (N); ++i) cnt[A[i]]++;
  long long ma = 1;
  long long s = 0;
  for (int i = K - 1; i >= 0; i--) {
    s += cnt[i];
    chmax(ma, (s - 1) / C[i] + 1);
  }
  vector<vector<int>> ans(ma);
  int now = 0;
  for (int i = K - 1; i >= 0; i--) {
    for (int j = 0; j < cnt[i]; j++) {
      ans[now].push_back(i + 1);
      now++;
      now %= ma;
    }
  }
  cout << ans.size() << "\n";
  for (int i = 0; i < (ans.size()); ++i) {
    cout << ans[i].size() << " ";
    for (int j = 0; j < (ans[i].size()); ++j) cout << ans[i][j] << " ";
    cout << "\n";
  }
  return 0;
}
