#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 7;
struct node {
  int u, v, w;
  friend bool operator<(node a, node b) { return a.w > b.w; }
} e[N];
int n, m, i, j, k, tot, fa[N], a[N], b[N];
long long sum, ans;
int find(int x) { return x == fa[x] ? x : fa[x] = find(fa[x]); }
int main() {
  for (scanf("%d%d", &m, &n), i = 1; i <= m; ++i) scanf("%d", a + i);
  for (i = 1; i <= n; ++i) scanf("%d", b + i);
  for (i = 1; i <= m; ++i) {
    for (scanf("%d", &k); k--;) {
      scanf("%d", &j);
      e[++tot] = node{i, m + j, a[i] + b[j]};
      sum += a[i] + b[j];
    }
  }
  for (i = 1; i <= n + m; ++i) fa[i] = i;
  for (sort(e + 1, e + tot + 1), i = 1; i <= tot; ++i)
    if (find(e[i].u) != find(e[i].v)) {
      ans += e[i].w;
      fa[find(e[i].u)] = find(e[i].v);
    }
  printf("%lld\n", sum - ans);
}
