#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 2;
long long n, m;
long long parent[N];
long long findpar(long long *u) {
  long long rank = 0;
  while (*u != parent[*u]) {
    *u = parent[*u];
    rank++;
  }
  return rank;
}
long long kruskal(vector<pair<long long, pair<long long, long long>>> edges,
                  long long nos) {
  sort(edges.rbegin(), edges.rend());
  for (long long i = 0; i < nos; i++) {
    parent[i] = i;
  }
  long long cost = 0;
  long long edg_count = 0;
  for (auto it = edges.begin(); it != edges.end() && edg_count < nos - 1;
       it++) {
    long long weight = (*it).first;
    pair<long long, long long> edge = (*it).second;
    long long u = edge.first, v = edge.second;
    long long rank_u = findpar(&u);
    long long rank_v = findpar(&v);
    if (u != v) {
      cost += weight;
      edg_count += 1;
      if (rank_u < rank_v) {
        parent[u] = v;
      } else {
        parent[v] = u;
      }
    }
  }
  return cost;
}
void solve() {
  cin >> m >> n;
  vector<long long> a(m), b(n);
  for (long long i = 0; i < m; i++) cin >> a[i];
  for (long long i = 0; i < n; i++) cin >> b[i];
  long long siz;
  vector<pair<long long, pair<long long, long long>>> edges;
  long long ans = 0;
  for (long long i = 0; i < m; i++) {
    cin >> siz;
    long long mem;
    for (long long j = 0; j < siz; j++) {
      cin >> mem;
      mem--;
      edges.push_back({a[i] + b[mem], {i, m + mem}});
      edges.push_back({a[i] + b[mem], {m + mem, i}});
      ans += a[i] + b[mem];
    }
  }
  long long cost = kruskal(edges, n + m);
  ans = ans - cost;
  cout << ans;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long i = 0, t = 1;
  while (i++ < t) {
    solve();
    cout << "\n";
  }
  return 0;
}
