#include <bits/stdc++.h>
using namespace std;
long long a[100010], b[100010];
vector<pair<long long, pair<long long, long long> > > viz;
long long p[200010], r[200020];
int find(int u) {
  if (p[u] == u)
    return u;
  else {
    p[u] = find(p[u]);
    return p[u];
  }
}
bool join(int i, int j) {
  long long x = find(i), y = find(j);
  if (x == y) return false;
  if (r[x] > r[y]) {
    p[y] = x;
  } else {
    p[x] = y;
    if (r[x] == r[y]) r[y]++;
  }
  return true;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int m, n;
  long long sum = 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++) {
    int x;
    cin >> x;
    for (int j = 1; j <= x; j++) {
      int u;
      cin >> u;
      viz.push_back({-a[i] - b[u], {i, m + u}});
      sum += a[i] + b[u];
    }
  }
  for (int i = 1; i <= m + n; i++) p[i] = i;
  sort(viz.begin(), viz.end());
  int ct = 0;
  for (auto w : viz) {
    if (ct == m + n - 1) break;
    int i = w.second.first, j = w.second.second;
    if (join(i, j)) {
      ct++;
      sum += w.first;
    }
  }
  cout << sum << endl;
}
