#include <bits/stdc++.h>
using namespace std;
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const double EPS = 1e-9;
const double PI = acos(-1.);
const long long LL_INF = 1e17 + 16;
const int INF = 1e9 + 10;
const long long MOD = 1e9 + 7;
const int MAXN = 3e5 + 5;
pair<long long, pair<int, int> > ee[MAXN];
int a[MAXN], b[MAXN];
int par[MAXN];
int get_par(int v) { return par[v] == v ? v : par[v] = get_par(par[v]); }
void solve() {
  int m, n;
  scanf("%d%d", &m, &n);
  for (int i = (0); i < (int)(m); i++) {
    scanf("%d", &a[i]);
  }
  for (int j = (0); j < (int)(n); j++) {
    scanf("%d", &b[j]);
  }
  int top = 0;
  long long ans = 0;
  for (int i = (0); i < (int)(m); i++) {
    int k;
    scanf("%d", &k);
    for (int j = (0); j < (int)(k); j++) {
      int c;
      scanf("%d", &c);
      c--;
      long long w = a[i] + b[c];
      ee[top++] = make_pair(w, make_pair(i, m + c));
    }
  }
  sort(ee, ee + top);
  reverse(ee, ee + top);
  for (int i = (0); i < (int)(n + m); i++) {
    par[i] = i;
  }
  for (int i = (0); i < (int)(top); i++) {
    int x = ee[i].second.first, y = ee[i].second.second;
    x = get_par(x);
    y = get_par(y);
    if (x != y) {
      par[x] = y;
    } else {
      ans += ee[i].first;
    }
  }
  printf("%lld\n", ans);
}
int main() {
  int t = 1;
  while (t--) {
    solve();
  }
}
