#include <bits/stdc++.h>
using namespace std;
long long n, m, a[200010], b[200010], mxtot = 0, ans = 0, fa[200010];
vector<pair<long long, pair<long long, long long> > > ed;
long long getf(long long x) {
  if (fa[x] == x) {
    return x;
  }
  return fa[x] = getf(fa[x]);
}
int main() {
  long long i, j, s, x, y;
  scanf("%lld%lld", &m, &n);
  for (i = 0; i < m; i++) {
    scanf("%lld", &a[i]);
  }
  for (i = 0; i < n; i++) {
    scanf("%lld", &b[i]);
  }
  for (i = 0; i < m; i++) {
    scanf("%lld", &s);
    for (j = 0; j < s; j++) {
      scanf("%lld", &x);
      x--;
      ed.push_back(make_pair(-(a[i] + b[x]), make_pair(x, i + n)));
      mxtot += a[i] + b[x];
    }
  }
  sort(ed.begin(), ed.end());
  for (i = 0; i < n + m; i++) {
    fa[i] = i;
  }
  for (i = 0; i < ed.size(); i++) {
    s = ed[i].first;
    x = ed[i].second.first;
    y = ed[i].second.second;
    if (getf(x) == getf(y)) {
      continue;
    }
    x = getf(x);
    y = getf(y);
    ans += s;
    fa[x] = y;
  }
  printf("%lld\n", mxtot + ans);
  return 0;
}
