#include <bits/stdc++.h>
using namespace std;
int N, M;
int par[100010], par2[100010];
int A[100010], B[100010];
vector<pair<int, int> > S;
int Find(int a) {
  if (par[a] == a) return a;
  return par[a] = Find(par[a]);
}
void Union(int a, int b) {
  if (Find(a) == Find(b)) return;
  par[Find(b)] = Find(a);
}
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cin >> M >> N;
  for (int i = 0; i < M; i++) cin >> A[i];
  for (int i = 1; i <= N; i++) cin >> B[i];
  for (int i = 0; i < M; i++) par[i] = i;
  long long ans = 0;
  for (int i = 0; i < M; i++) {
    int x;
    cin >> x;
    while (x--) {
      int y;
      cin >> y;
      S.emplace_back(i, y);
      ans += A[i] + B[y];
    }
  }
  sort(S.begin(), S.end(), [&](pair<int, int> a, pair<int, int> b) {
    return A[a.first] + B[a.second] > A[b.first] + B[b.second];
  });
  for (int i = 1; i <= N; i++) par2[i] = -1;
  for (pair<int, int> pt : S) {
    if (par2[pt.second] == -1) {
      par2[pt.second] = pt.first;
      ans -= A[pt.first] + B[pt.second];
      continue;
    }
    if (Find(pt.first) == Find(par2[pt.second])) continue;
    Union(pt.first, par2[pt.second]);
    ans -= A[pt.first] + B[pt.second];
  }
  cout << ans;
}
