#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 5;
long long n, m, cnt, Ans, x, z, a[N], b[N], fa[N];
struct node {
  long long fr, to, w;
} e[N];
long long fd(long long x) { return (x == fa[x]) ? x : fa[x] = fd(fa[x]); }
bool cmp(node x, node y) { return x.w > y.w; }
signed main() {
  scanf("%d%d", &n, &m);
  for (long long i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
  }
  for (long long i = 1; i <= m; ++i) {
    scanf("%d", &b[i]);
  }
  for (long long i = 1; i <= n; ++i) {
    scanf("%d", &z);
    for (long long j = 1; j <= z; ++j) {
      scanf("%d", &x);
      e[++cnt] = (node){i, x + n, a[i] + b[x]};
      Ans += (a[i] + b[x]);
    }
  }
  for (long long i = 1; i <= n + m; ++i) fa[i] = i;
  sort(e + 1, e + cnt + 1, cmp);
  for (long long i = 1; i <= cnt; ++i) {
    long long x = e[i].fr, y = e[i].to;
    long long u = fd(x), v = fd(y);
    if (u == v) continue;
    fa[u] = v, Ans -= (e[i].w);
  }
  cout << Ans << endl;
  return 0;
}
