#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  char ch = getchar();
  long long s = 0, w = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    s = s * 10 + ch - '0';
    ch = getchar();
  }
  return s * w;
}
long long n, m;
long long a[200010], b[200010], fa[200010];
long long answer;
struct edge {
  long long u, v, w;
} t[200010 << 1];
long long tot;
inline long long cmp(edge a, edge b) { return a.w > b.w; }
long long find(long long x) { return x == fa[x] ? x : fa[x] = find(fa[x]); }
int main() {
  m = read(), n = read();
  for (register int i = 1; i <= m; i++) a[i] = read();
  for (register int i = 1; i <= n; i++) b[i] = read();
  for (register int i = 1; i <= m; i++) {
    long long sz = read();
    while (sz--) {
      long long x = read();
      t[++tot] = (edge){i + n, x, a[i] + b[x]};
      answer += a[i] + b[x];
    }
  }
  for (register int i = 1; i <= n + m; i++) fa[i] = i;
  sort(t + 1, t + tot + 1, cmp);
  for (register int i = 1; i <= tot; i++) {
    long long x = t[i].u, y = t[i].v;
    x = find(x), y = find(y);
    if (x == y) continue;
    fa[x] = y;
    answer -= t[i].w;
  }
  printf("%lld\n", answer);
  return 0;
}
