#include <bits/stdc++.h>
using namespace std;
const int maxn = 200100;
int N, M, A[maxn], B[maxn];
int par[maxn], sz[maxn];
int anc(int u) { return par[u] == u ? u : par[u] = anc(par[u]); }
bool merge(int u, int v) {
  u = anc(u);
  v = anc(v);
  if (u == v) return 0;
  if (sz[u] < sz[v]) swap(u, v);
  sz[u] += sz[v];
  par[v] = u;
  return 1;
}
struct edge {
  int u, v, w;
  edge() {}
  edge(int u, int v, int w) : u(u), v(v), w(w) {}
  bool operator<(const edge &other) const { return w > other.w; }
};
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> M >> N;
  for (int i = 1; i <= M; ++i) cin >> A[i];
  for (int i = 1; i <= N; ++i) cin >> B[i];
  for (int i = 1; i <= M + N; ++i) {
    par[i] = i;
    sz[i] = 1;
  }
  vector<edge> Ed;
  using ll = long long;
  ll tot = 0;
  for (int i = 1; i <= M; ++i) {
    int S;
    cin >> S;
    for (int X, j = 1; j <= S; ++j) {
      cin >> X;
      tot += A[i] + B[X];
      Ed.emplace_back(i, X + M, A[i] + B[X]);
    }
  }
  sort(Ed.begin(), Ed.end());
  for (edge E : Ed) {
    if (merge(E.u, E.v)) tot -= E.w;
  }
  cout << tot << '\n';
  return 0;
}
