#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
struct edge {
  int fro, to, co;
} e[N << 1];
int m, n, tot = 0;
int a[N], b[N], fa[N];
int find(int x) {
  if (fa[x] == x) return x;
  return fa[x] = find(fa[x]);
}
void merge(int u, int v) {
  u = find(u), v = find(v);
  if (u == v) return;
  fa[u] = v;
  return;
}
int cmp(edge a, edge b) { return a.co > b.co; }
void addedge(int u, int v, int w) {
  e[++tot] = edge{u, v, w};
  return;
}
long long MST() {
  sort(e + 1, e + tot + 1, cmp);
  for (int i = (1), _x = (n + m); i <= _x; i++) fa[i] = i;
  long long ans = 0;
  for (int i = (1), _x = (tot); i <= _x; i++) {
    int u = e[i].fro, v = e[i].to;
    if (find(u) == find(v)) continue;
    merge(u, v);
    ans += e[i].co;
  }
  return ans;
}
int main() {
  scanf("%d%d", &m, &n);
  for (int i = (1), _x = (m); i <= _x; i++) scanf("%d", &a[i]);
  for (int i = (1), _x = (n); i <= _x; i++) scanf("%d", &b[i]);
  int s;
  long long all = 0;
  for (int i = (1), _x = (m); i <= _x; i++) {
    scanf("%d", &s);
    int to;
    for (int j = (1), _x = (s); j <= _x; j++) {
      scanf("%d", &to);
      addedge(i, to + m, a[i] + b[to]);
      all += a[i] + b[to];
    }
  }
  printf("%lld\n", all - MST());
  return 0;
}
