#include <bits/stdc++.h>
struct edge {
  int x, y, w;
} e[200005];
int a[100005], b[100005], fa[200005];
inline int read() {
  register int x = 0, f = 1;
  register char s = getchar();
  while (s > '9' || s < '0') {
    if (s == '-') f = -1;
    s = getchar();
  }
  while (s >= '0' && s <= '9') {
    x = x * 10 + s - '0';
    s = getchar();
  }
  return x * f;
}
inline int find(int x) { return fa[x] == x ? x : fa[x] = find(fa[x]); }
inline bool cmp(const edge &x, const edge &y) { return x.w > y.w; }
int main() {
  int m = read(), n = read(), tot = 0;
  long long ans = 0;
  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) {
    int s = read();
    for (register int j = 1; j <= s; ++j) {
      ++tot;
      e[tot].x = read();
      e[tot].y = i + n;
      ans += (e[tot].w = a[i] + b[e[tot].x]);
    }
  }
  std::sort(e + 1, e + 1 + tot, cmp);
  for (register int i = 1; i <= n + m; ++i) fa[i] = i;
  for (register int i = 1; i <= tot; ++i) {
    int fx = find(e[i].x), fy = find(e[i].y);
    if (fx != fy) {
      ans -= e[i].w;
      fa[fx] = fy;
    }
  }
  printf("%lld\n", ans);
  return 0;
}
