#include <bits/stdc++.h>
using namespace std;
long long gi() {
  char cc = getchar();
  long long cn = 0, flus = 1;
  while (cc < '0' || cc > '9') {
    if (cc == '-') flus = -flus;
    cc = getchar();
  }
  while (cc >= '0' && cc <= '9') cn = cn * 10 + cc - '0', cc = getchar();
  return cn * flus;
}
const long long N = 1e6 + 5;
long long n, m, cnt, Ans, a[N], b[N], fa[N];
struct E {
  long long fr, to, w;
} e[N];
long long fd(long long x) { return (x == fa[x]) ? x : fa[x] = fd(fa[x]); }
bool cmp(E x, E y) { return x.w > y.w; }
signed main() {
  n = gi(), m = gi();
  for (register long long i = (1); i <= (n); ++i) a[i] = gi();
  for (register long long i = (1); i <= (m); ++i) b[i] = gi();
  for (register long long i = (1); i <= (n); ++i) {
    long long z = gi(), x;
    for (register long long j = (1); j <= (z); ++j) {
      x = gi();
      e[++cnt] = (E){i, x + n, a[i] + b[x]};
      Ans += (a[i] + b[x]);
    }
  }
  for (long long i = 1; i <= n + m; ++i) fa[i] = i;
  sort(e + 1, e + cnt + 1, cmp);
  for (register long long i = (1); i <= (cnt); ++i) {
    long long x = e[i].fr, y = e[i].to;
    long long u = fd(x), v = fd(y);
    if (u == v) continue;
    fa[u] = v, Ans -= (e[i].w);
  }
  cout << Ans << endl;
  return 0;
}
