#include <bits/stdc++.h>
using namespace std;
const int maxn = 4e5 + 5;
struct edge {
  int u, v, w;
  edge(int a = 0, int b = 0, int c = 0) { u = a, v = b, w = c; }
} G[maxn];
int fa[maxn], a[maxn], b[maxn], tot;
int find(int x) { return fa[x] == x ? x : fa[x] = find(fa[x]); }
bool merge(int x, int y) {
  x = find(x), y = find(y);
  if (x == y) return false;
  fa[x] = y;
  return true;
}
int main() {
  int m, n;
  scanf("%d %d", &m, &n);
  for (int i = 1; i <= m; i++) scanf("%d", &a[i]), fa[i + n] = i + n;
  for (int i = 1; i <= n; i++) scanf("%d", &b[i]), fa[i] = i;
  long long ans = 0;
  for (int i = 1, s; i <= m; i++) {
    scanf("%d", &s);
    for (int j = 1, t; j <= s; j++) {
      scanf("%d", &t);
      G[tot++] = edge(i + n, t, a[i] + b[t]);
      ans += a[i] + b[t];
    }
  }
  sort(G, G + tot, [](const edge &a, const edge &b) {
    if (a.w != b.w) return a.w > b.w;
    if (a.u != b.u) return a.u < b.u;
    return a.v < b.v;
  });
  for (int i = 0; i < tot; i++)
    if (merge(G[i].u, G[i].v)) ans -= G[i].w;
  printf("%lld\n", ans);
  return 0;
}
