#include <bits/stdc++.h>
using namespace std;
const long long md = 1e9 + 7;
const int xn = 2e5 + 10;
const int xm = -20 + 10;
const int SQ = 450;
const int sq = 1e3 + 10;
const int inf = 1e9 + 10;
const long long INF = 1e18 + 10;
long long power(long long a, long long b) {
  return (!b ? 1
             : (b & 1 ? a * power(a * a % md, b / 2) % md
                      : power(a * a % md, b / 2) % md));
}
long long zarb(long long a, long long b) { return (a * b + 10 * md) % md; }
long long jaam(long long a, long long b) { return (a + b + 10 * md) % md; }
string abc = "abcdefghijklmnopqrstuvwxyz";
int n, k, num[xn], c[xn], seg[xn * 4];
vector<int> vec[xn];
void Build(int id, int L, int R) {
  if (R - L == 1) {
    seg[id] = c[L];
    return;
  }
  int Mid = (L + R) / 2;
  Build(id * 2, L, Mid);
  Build(id * 2 + 1, Mid, R);
  seg[id] = min(seg[id * 2], seg[id * 2 + 1]);
}
int get(int id, int L, int R, int Ql, int Qr) {
  if (Qr <= L || R <= Ql) return inf;
  if (Ql <= L && R <= Qr) return seg[id];
  int Mid = (L + R) / 2;
  return min(get(id * 2, L, Mid, Ql, Qr), get(id * 2 + 1, Mid, R, Ql, Qr));
}
bool Check(int x) {
  for (int i = 0; i < x; ++i) vec[i].clear();
  for (int i = 0; i < n; ++i) vec[i % x].push_back(num[i]);
  for (int i = 0; i < x; ++i) {
    int t = int(vec[i].size());
    int last = 0;
    for (int j = 0; j < t; ++j) {
      if (get(1, 1, k + 1, last + 1, vec[i][j] + 1) < t - j) return false;
      last = vec[i][j];
    }
  }
  return true;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> k;
  for (int i = 0; i < n; ++i) cin >> num[i];
  for (int i = 1; i <= k; ++i) cin >> c[i];
  Build(1, 1, k + 1);
  sort(num, num + n);
  int L = 0, R = n, Mid;
  while (R - L > 1) {
    Mid = (L + R) / 2;
    if (Check(Mid))
      R = Mid;
    else
      L = Mid;
  }
  cout << R << '\n';
  Check(R);
  for (int i = 0; i < R; ++i) {
    cout << int(vec[i].size()) << ' ';
    for (int x : vec[i]) cout << x << ' ';
    cout << '\n';
  }
  return 0;
}
