#include <bits/stdc++.h>
using namespace std;
long long findParent(long long x, long long parent[]) {
  if (parent[x] == x) return x;
  parent[x] = findParent(parent[x], parent);
  return parent[x];
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long i, j, k, n, m, ans = 0;
  cin >> m >> n;
  vector<pair<long long, pair<long long, long long> > > edges;
  long long a[m + 1], b[n + 1], parent[n + m + 2];
  long long offset = n;
  for (i = 0; i < m; i++) cin >> a[i];
  for (i = 0; i < n; i++) cin >> b[i];
  for (i = 0; i < m; i++) {
    long long len;
    cin >> len;
    for (j = 0; j < len; j++) {
      long long x;
      cin >> x;
      x--;
      ans += (a[i] + b[x]);
      edges.push_back({a[i] + b[x], {offset + i, x}});
    }
  }
  sort(edges.begin(), edges.end());
  reverse(edges.begin(), edges.end());
  vector<long long> rank(n + m + 1, 0);
  for (i = 0; i < n + m + 1; i++) parent[i] = i;
  for (auto el : edges) {
    long long set1 = findParent(el.second.first, parent);
    long long set2 = findParent(el.second.second, parent);
    if (set1 == set2) continue;
    if (rank[set1] >= rank[set2]) {
      parent[set2] = set1;
      if (rank[set1] == rank[set2]) rank[set1]++;
    } else
      parent[set1] = set2;
    ans -= el.first;
  }
  cout << ans << endl;
  return 0;
}
