#include <bits/stdc++.h>
using namespace std;
int const N = 100000, Z = 2 * N;
int a[N + 1], b[N + 1], pa[Z + 1];
int P(int v) { return pa[v] ? pa[v] = P(pa[v]) : v; }
int main() {
  int m, n;
  scanf("%d%d", &m, &n);
  for (int i = 1; i < (int)(m + 1); ++i) scanf("%d", a + i);
  for (int i = 1; i < (int)(n + 1); ++i) scanf("%d", b + i);
  vector<pair<int, pair<int, int> > > ed;
  for (int i = 1; i < (int)(m + 1); ++i) {
    int s;
    scanf("%d", &s);
    for (int j = 0; j < (int)(s); ++j) {
      int t;
      scanf("%d", &t);
      ed.emplace_back(a[i] + b[t], make_pair(i, m + t));
    }
  }
  long long an = 0;
  sort(ed.begin(), ed.end());
  for (int i = ed.size() - 1; i >= 0; --i) {
    int x = P(ed[i].second.first), y = P(ed[i].second.second);
    if (x == y)
      an += ed[i].first;
    else
      pa[y] = x;
  }
  printf("%lld\n", an);
}
