#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1e5;
int par[2 * MAX_N], idSize[2 * MAX_N];
int inpA[MAX_N];
int inpB[MAX_N];
vector<pair<int, pair<int, int> > > G;
int get(int v) {
  if (par[v] != v) par[v] = get(par[v]);
  return par[v];
}
void join(int v, int u) {
  v = get(v), u = get(u);
  if (v == u) return;
  if (idSize[v] < idSize[u]) swap(u, v);
  par[u] = v;
  idSize[v] += idSize[u];
  return;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int m, n;
  cin >> m >> n;
  for (int i = 0; i < n + m; i++) par[i] = i, idSize[i] = 1;
  for (int i = 0; i < m; i++) cin >> inpA[i];
  for (int i = 0; i < n; i++) cin >> inpB[i];
  for (int i = 0; i < m; i++) {
    int s;
    cin >> s;
    for (int j = 0; j < s; j++) {
      int a;
      cin >> a;
      G.push_back({inpA[i] + inpB[a - 1], {n + i, a - 1}});
    }
  }
  sort(G.rbegin(), G.rend());
  long long ans = 0;
  for (auto i : G) {
    if (get(i.second.first) == get(i.second.second)) ans += i.first;
    join(i.second.first, i.second.second);
  }
  cout << ans;
  return 0;
}
