#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 5;
long long n, m, ans, cnt, a[N], b[N], fa[N];
inline long long read() {
  long long ret = 0, f = 0;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = 1;
    c = getchar();
  }
  while (isdigit(c)) {
    ret = ret * 10 + c - 48;
    c = getchar();
  }
  if (f) return -ret;
  return ret;
}
struct node {
  long long x, y, z;
} e[N];
bool operator<(node a, node b) { return a.z > b.z; }
long long find(long long x) {
  if (fa[x] == x) return x;
  fa[x] = find(fa[x]);
  return fa[x];
}
signed main() {
  n = read();
  m = read();
  for (long long i = 1; i <= n; i++) a[i] = read();
  for (long long i = 1; i <= m; i++) b[i] = read();
  for (long long i = 1; i <= n; i++) {
    long long gs = read();
    for (long long j = 1; j <= gs; j++) {
      long long x = read();
      e[++cnt] = (node){x, m + i, a[i] + b[x]};
      ans += a[i] + b[x];
    }
  }
  for (long long i = 1; i <= m + n; i++) fa[i] = i;
  sort(e + 1, e + cnt + 1);
  for (long long i = 1; i <= cnt; i++) {
    long long x = find(e[i].x), y = find(e[i].y), z = e[i].z;
    if (x == y) continue;
    ans -= z;
    fa[x] = y;
  }
  cout << ans;
  return 0;
}
