#include <bits/stdc++.h>
using namespace std;
const long long inf = (long long)1e18;
const long long mod = (long long)1e9 + 7;
const double eps = (double)1e-9;
const double pi = acos(-1.0);
const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};
const int N = 200500;
pair<int, int> pr[N];
int n, m, sz, a[N], b[N], p[N], h[N], root[N];
inline bool cmp(pair<int, int> i, pair<int, int> j) {
  return a[i.first] + b[i.second] > a[j.first] + b[j.second];
}
int get(int v) { return (v == p[v] ? v : p[v] = get(p[v])); }
inline int unite(int x, int y) {
  x = get(x), y = get(y);
  if (h[x] > h[y]) swap(x, y);
  p[x] = y, h[y] += h[x] == h[y];
  return y;
}
int main() {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  cin >> m >> n;
  for (int i = 1; i <= m; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) cin >> b[i];
  long long ans = 0;
  for (int i = 1; i <= m; i++) {
    int cnt;
    cin >> cnt;
    while (cnt--) {
      int x;
      cin >> x;
      pr[++sz] = {i, x};
      ans += a[i] + b[x];
    }
  }
  sort(pr + 1, pr + 1 + sz, &cmp);
  for (int i = 1; i <= n; i++) p[i] = i;
  for (int i = 1; i <= sz; i++) {
    int v = pr[i].second, id = pr[i].first;
    if (!root[id]) {
      root[id] = get(v);
      ans -= a[id] + b[v];
    } else if (get(root[id]) != get(v)) {
      root[id] = unite(root[id], v);
      ans -= a[id] + b[v];
    }
  }
  cout << ans;
  return 0;
}
