#include <bits/stdc++.h>
using namespace std;
long long poww(long long a, long long b, long long md) {
  return (!b ? 1
             : (b & 1 ? a * poww(a * a % md, b / 2, md) % md
                      : poww(a * a % md, b / 2, md) % md));
}
const long long MAXN = 1e6 + 10;
const long long INF = 8e18;
const long long MOD = 1e9 + 7;
int n, m, A[MAXN], B[MAXN], par[MAXN], H[MAXN];
vector<pair<long long, pair<long long, long long>>> edges;
int Find(int v) {
  if (v == par[v]) return v;
  return par[v] = Find(par[v]);
}
inline void Union(int v, int u) {
  if (H[u] < H[v]) swap(v, u);
  par[v] = u;
  if (H[u] == H[v]) H[u]++;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(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 = 0; i < MAXN; i++) par[i] = i;
  long long tot = 0;
  for (int i = 1; i <= m; i++) {
    int s;
    cin >> s;
    for (int j = 0; j < s; j++) {
      int v;
      cin >> v;
      edges.push_back({A[i] + B[v], {v, i + n}});
      tot += A[i] + B[v];
    }
  }
  sort((edges).begin(), (edges).end());
  reverse((edges).begin(), (edges).end());
  for (auto e : edges) {
    int u = e.second.first, v = e.second.second;
    u = Find(u);
    v = Find(v);
    if (u == v) continue;
    tot -= e.first;
    Union(u, v);
  }
  cout << tot << '\n';
  return 0;
}
