#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 100;
struct node {
  int u, v;
  long long w;
  bool operator<(const node &r) const { return w > r.w; }
} edge[maxn << 2];
int n, m;
long long a[maxn];
int father[maxn];
int findfather(int x) {
  int a = x;
  while (x != father[x]) x = father[x];
  while (a != father[a]) {
    int z = a;
    a = father[a];
    father[z] = x;
  }
  return x;
}
int main() {
  long long ans = 0;
  int tot = 0;
  scanf("%d%d", &m, &n);
  for (int i = 1; i <= n + m; i++) scanf("%lld", a + i), father[i] = i;
  for (int i = 1; i <= m; i++) {
    int k;
    scanf("%d", &k);
    for (int j = 1; j <= k; j++) {
      int x;
      scanf("%d", &x);
      long long v = a[i] + a[m + x];
      ans += v;
      edge[++tot] = {i, m + x, v};
    }
  }
  sort(edge + 1, edge + tot + 1);
  for (int i = 1; i <= tot; i++) {
    int x = edge[i].u;
    int y = edge[i].v;
    x = findfather(x);
    y = findfather(y);
    if (x == y) continue;
    ans -= edge[i].w;
    father[y] = x;
  }
  printf("%lld\n", ans);
}
