#include <bits/stdc++.h>
using namespace std;
int main() {
  set<pair<long long int, long long int>> ans;
  long long int n, k;
  cin >> n >> k;
  long long int arr[k + 1];
  long long int ts;
  memset(arr, 0, sizeof(arr));
  for (int i = 0; i < n; i++) {
    cin >> ts;
    arr[ts]++;
  }
  long long int cost[k + 1];
  for (int i = 0; i < k; i++) {
    cin >> cost[i];
  }
  ans.insert({0, 1});
  vector<long long int> adj[n + 1];
  long long int rank = 2;
  for (long long int i = k; i >= 1; i--) {
    long long int c = cost[i - 1];
    while (arr[i]--) {
      auto l = ans.begin();
      if (l->first < c) {
        adj[l->second].push_back(i);
        ans.insert({l->first + 1, l->second});
        ans.erase(l);
      } else {
        ans.insert({1, rank});
        adj[rank].push_back(i);
        rank++;
      }
    }
  }
  cout << ans.size() << endl;
  for (auto l : ans) {
    cout << l.first << " ";
    for (auto k : adj[l.second]) {
      cout << k << " ";
    }
    cout << endl;
  }
}
