#include <bits/stdc++.h>
using namespace std;
const long long maxn = 2e5 + 100;
struct EDGE {
  long long u, v, quan;
} edge[maxn * 2];
long long fa[maxn], n, m, a[maxn], b[maxn], tot = 0, tag[maxn * 2];
bool cmp(const EDGE& xx, const EDGE& yy) { return xx.quan > yy.quan; }
EDGE lc(long long aa, long long bb, long long cc) {
  EDGE ls;
  ls.quan = cc;
  ls.u = aa;
  ls.v = bb;
  return ls;
}
long long find(long long x) {
  if (x == fa[x]) return x;
  long long ff = fa[x];
  fa[x] = find(ff);
  return fa[x];
}
void merge(long long x, long long y) { fa[find(x)] = find(y); }
int main() {
  long long i, j, kk, x;
  scanf("%lld%lld", &m, &n);
  for (i = 1; i <= m; i++) scanf("%lld", &a[i]);
  for (i = 1; i <= n; i++) scanf("%lld", &b[i]), fa[i] = i;
  long long all = 0;
  for (i = 1; i <= m; i++) {
    scanf("%lld", &kk);
    for (j = 1; j <= kk; j++) {
      scanf("%lld", &x);
      edge[++tot] = lc(i, x, a[i] + b[x]);
      all += a[i] + b[x];
    }
  }
  sort(edge + 1, edge + tot + 1, cmp);
  for (i = 1; i <= tot; i++) {
    if (!tag[edge[i].u]) {
      tag[edge[i].u] = find(edge[i].v);
      all -= edge[i].quan;
    } else {
      if (find(tag[edge[i].u]) != find(edge[i].v)) {
        merge(tag[edge[i].u], edge[i].v);
        all -= edge[i].quan;
      }
    }
  }
  cout << all;
  return 0;
}
