#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
using namespace std;
long long a[100005], b[100005], p[100005];
long long fin(long long x) {
  if (x == p[x]) return x;
  return p[x] = fin(p[x]);
}
bool merge(long long x, long long y) {
  x = fin(x);
  y = fin(y);
  if (x == y) return false;
  p[x] = y;
  return true;
}
void solve() {
  long long n, m;
  cin >> m >> n;
  vector<tuple<long long, long long, long long>> edges;
  for (long long i = 0; i < m; i++) cin >> a[i];
  for (long long i = 0; i < n; i++) cin >> b[i];
  for (long long i = 0; i < m; i++) {
    long long s;
    cin >> s;
    for (long long j = 0; j < s; j++) {
      long long x;
      cin >> x;
      x--;
      edges.push_back({a[i] + b[x], i, m + x});
    }
  }
  sort(edges.rbegin(), edges.rend());
  for (long long i = 0; i < (n + m); i++) p[i] = i;
  long long ans = 0;
  for (auto &[w, x, y] : edges) {
    if (!merge(x, y)) ans += w;
  }
  cout << ans << "\n";
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) solve();
  return 0;
}
