#include <bits/stdc++.h>
using namespace std;
long long a[100005], b[100005], kq, m, n, cnt, x, p, f[100005], u, c[100005], y;
pair<long long, pair<int, int> > v[200005];
int phin(int u) { return f[u] < 0 ? u : f[u] = phin(f[u]); }
void uni(int u, int v) {
  if (f[u] > f[v]) swap(u, v);
  f[u] += f[v];
  f[v] = u;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> m >> n;
  for (int i = 1; i <= m; ++i) cin >> a[i];
  for (int i = 1; i <= n; ++i) cin >> b[i];
  for (int i = 1; i <= m; ++i) {
    cin >> x;
    for (int j = 1; j <= x; ++j) {
      cin >> p;
      v[++cnt] = {a[i] + b[p], {i, p}};
      kq = kq + a[i] + b[p];
    }
  }
  sort(v + 1, v + cnt + 1);
  memset(f, -1, sizeof(f));
  for (int i = cnt; i > 0; --i) {
    u = v[i].second.first;
    p = v[i].second.second;
    int kt = false;
    if (c[p] == 0) {
      c[p] = u;
      kt = true;
    } else {
      x = phin(u);
      y = phin(c[p]);
      if (x != y) {
        uni(x, y);
        kt = true;
      }
    }
    if (kt) kq -= v[i].first;
  }
  cout << kq;
  return 0;
}
