#include <bits/stdc++.h>
using namespace std;
namespace Flandre_Scarlet {
char _c;
int I() {
  int x = 0;
  int f = 1;
  while (_c < '0' or _c > '9') f = (_c == '-') ? -1 : 1, _c = getchar();
  while (_c >= '0' and _c <= '9')
    x = (x << 1) + (x << 3) + (_c ^ 48), _c = getchar();
  return (x = (f == 1) ? x : -x);
}
void Rd(int cnt, ...) {
  va_list args;
  va_start(args, cnt);
  for (int i = 1; i <= cnt; ++i) {
    int* x = va_arg(args, int*);
    (*x) = I();
  }
  va_end(args);
}
int n, k;
int m[255555], c[255555];
void Input() {
  Rd(2, &n, &k);
  for (int i = 1; i <= n; ++i) m[i] = I();
  for (int i = 1; i <= k; ++i) c[i] = I();
}
int ceild(int a, int b) { return (a + b - 1) / b; }
int part[255555];
vector<int> g[255555];
void go(int x, int id) { g[id].push_back(x); }
void Soviet() {
  sort(m + 1, m + n + 1);
  reverse(m + 1, m + n + 1);
  int Maxk = 1;
  for (int i = 2; i <= n; ++i)
    if (ceild(i, c[m[i]]) > ceild(Maxk, c[m[Maxk]])) Maxk = i;
  int ans = ceild(Maxk, c[m[Maxk]]);
  printf("%d\n", ans);
  for (int i = 1; i <= n; ++i) g[i % ans].push_back(i);
  for (int i = 0; i <= ans - 1; ++i) {
    printf("%d ", ((int)g[i].size()));
    for (int j = 0; j <= ((int)g[i].size()) - 1; ++j) printf("%d ", m[g[i][j]]);
    putchar('\n');
  }
}
void IsMyWife() {
  Input();
  Soviet();
}
}  // namespace Flandre_Scarlet
int main() {
  Flandre_Scarlet::IsMyWife();
  getchar();
  getchar();
  return 0;
}
