#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(vector<T> &v, int n) {
  for (int i = 0; i < n; i++) cin >> v[i];
}
template <typename T>
inline void read(T &n) {
  cin >> n;
}
inline void read(string &s) { cin >> s; }
template <typename T>
inline void dbgc(const char *txt, T &c) {
  cout << txt << ": ";
  for (auto it = c.begin(); it != c.end(); it++) cout << *it << " ";
  cout << endl;
}
template <typename T>
inline void dbgx(const char *txt, T x) {
  cout << txt << ": ";
  cout << x << endl;
}
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
void solve() {
  int n, k;
  cin >> n >> k;
  vector<int> m(n);
  vector<int> freq(k + 1, 0);
  for (int i = 0; i < n; i++) {
    cin >> m[i];
    freq[m[i]]++;
  }
  vector<int> cnt(k + 1);
  vector<int> g(k + 1);
  for (int i = 1; i <= k; i++) {
    cin >> cnt[i];
  }
  g[k] = freq[k];
  for (int i = k - 1; i >= 0; i--) {
    g[i] = freq[i] + g[i + 1];
  }
  int lo = 1, hi = n;
  int testcase = -1;
  auto check = [&](int test) {
    bool possible = true;
    for (int i = k; i >= 1; i--) {
      int limit = (g[i] + test - 1) / test;
      if (limit > cnt[i]) {
        possible = false;
        break;
      }
    }
    return possible;
  };
  auto printAns = [&](int test) {
    vector<vector<int>> testcase(test + 1);
    sort(m.begin(), m.end());
    for (int i = 0; i < n; i++) {
      testcase[1 + (i % test)].push_back(m[i]);
    }
    for (int i = 1; i <= test; i++) {
      cout << int(testcase[i].size()) << " ";
      for (auto arr : testcase[i]) {
        cout << arr << " ";
      }
      cout << endl;
    }
  };
  while (lo <= hi) {
    int mid = (lo + hi) >> 1;
    if (check(mid)) {
      testcase = mid;
      hi = mid - 1;
    } else
      lo = mid + 1;
  }
  assert(testcase <= n);
  cout << testcase << endl;
  printAns(testcase);
}
int main() {
  ios ::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int tt = 1;
  for (int tc = 1; tc <= tt; tc++) {
    solve();
  }
}
