#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
long long a[N], b[N];
int n, m, par[N];
vector<tuple<long long, int, int>> edges;
inline int find(int x) { return par[x] == x ? x : par[x] = find(par[x]); }
bool unite(int u, int v) {
  u = find(u), v = find(v);
  if (u == v) return 0;
  if (rand() & 1) swap(u, v);
  par[u] = v;
  return 1;
}
int main() {
  cin >> m >> n;
  for (int i = 1; i <= m; ++i) {
    scanf("%lld", a + i);
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", b + i);
  }
  long long ans = 0;
  for (int i = 1; i <= m; ++i) {
    int sz, x;
    scanf("%d", &sz);
    while (sz--) {
      scanf("%d", &x);
      ans += a[i] + b[x];
      edges.emplace_back(-a[i] - b[x], i, m + x);
    }
  }
  sort(edges.begin(), edges.end());
  for (int i = 1; i <= m + n; ++i) par[i] = i;
  for (auto [cost, u, v] : edges) {
    if (unite(u, v)) ans += cost;
  }
  cout << ans << '\n';
  return 0;
}
