#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
template <typename T1>
void print(vector<T1> arr) {
  int l = (int)arr.size();
  cerr << "[";
  for (int i = 0; i < l; i++) {
    (i == l - 1) ? cerr << arr[i] : cerr << arr[i] << ",";
  }
  cerr << "]"
       << "\n";
}
template <typename T1>
void printArr(int arr[], int l) {
  cerr << "[";
  for (int i = 0; i < (int)l; i++) {
    (i == l - 1) ? cerr << arr[i] : cerr << arr[i] << ",";
  }
  cerr << "]"
       << "\n";
}
template <typename T1>
void console(vector<vector<T1>> arr) {
  for (int i = 0; i < (int)arr.size(); ++i) {
    cerr << "\n"
         << " [";
    for (int j = 0; j < (int)arr[i].size(); ++j) {
      (j == (int)arr[i].size() - 1) ? cerr << arr[i][j]
                                    : cerr << arr[i][j] << ",";
    }
    cerr << "]";
  }
  cerr << "\n";
}
template <typename T1, typename T2>
void mapped(map<T1, T2> m) {
  for (auto ite = m.begin(); ite != m.end(); ++ite) {
    cerr << "'" << ite->first << "'"
         << " : " << ite->second << "\n";
  }
}
template <typename T1, typename T2>
void mappedArr(map<T1, vector<T2>> m) {
  for (auto ity = m.begin(); ity != m.end(); ++ity) {
    cerr << "'" << ity->first << "'"
         << " : "
         << "[";
    for (int i = 0; i < (int)ity->second.size(); ++i) {
      (i == (int)ity->second.size() - 1) ? cerr << ity->second[i]
                                         : cerr << ity->second[i] << ",";
    }
    cerr << "]"
         << "\n";
  }
}
string int_to_string(int x) {
  stringstream ss;
  ss << x;
  string ni = ss.str();
  return ni;
}
int char_to_int(char c) {
  int n = (int)c - 48;
  return n;
}
int string_to_int(string x) {
  int n;
  stringstream s(x);
  s >> n;
  return n;
}
template <typename T1, typename T2>
void vectPair(vector<pair<T1, T2>> vp) {
  for (int arrp = 0; arrp < (int)vp.size(); ++arrp) {
    cerr << "(" << vp[arrp].first << "," << vp[arrp].second << ")"
         << "\n";
  }
}
long long power(long long a, long long n) {
  long long ans = 1;
  for (long long i = 0; pow(2, i) <= n; ++i) {
    if ((n >> i) & 1) {
      ans *= a;
    }
    a = a * a;
  }
  return ans;
}
const int MOD = 1e9 + 7;
void inverse(vector<long long>& v, long long w, long long p) {
  v[1] = 1;
  for (long long i = 2; i < w; ++i) {
    v[i] = (p - (p / i) * v[p % i] % p) % p;
  }
}
const long long INF = 1e18L + 5;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n, m;
  cin >> n >> m;
  vector<int> v(n);
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
  }
  vector<int> a(m);
  for (int i = 0; i < m; ++i) {
    cin >> a[i];
  }
  sort(v.rbegin(), v.rend());
  vector<int> cnt(m + 2);
  int p = 0;
  for (int i = m; i > 0; --i) {
    if (p == n) {
      break;
    }
    int ct = 0;
    while (p < n && v[p] >= i) {
      p++;
      ct++;
    }
    cnt[i] = cnt[i + 1] + ct;
  }
  int maxm = 0;
  for (int i = m - 1; i >= 0; --i) {
    int z = (cnt[i + 1] / a[i]);
    z += (cnt[i + 1] % a[i] != 0) ? 1 : 0;
    maxm = max(maxm, z);
  }
  cout << maxm << "\n";
  vector<vector<int>> ans(maxm);
  int ph = 0;
  for (int i = 0; i < n; ++i) {
    int x = ph % maxm;
    ans[x].push_back(v[i]);
    ph++;
  }
  for (int i = 0; i < maxm; ++i) {
    cout << (int)ans[i].size() << " ";
    for (int j = 0; j < (int)ans[i].size(); ++j) {
      cout << ans[i][j] << " ";
    }
    cout << endl;
  }
}
