#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool min2(T &a, const T &b) {
  return b < a ? a = b, 1 : 0;
}
template <typename T>
inline bool max2(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
const int mod = 1e9 + 7;
const int P1 = 999983, P2 = 999979;
const long double PI = acos((long double)-1);
const int dir[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
const long long INF = 1e18;
const int N = 1e6 + 5;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int a[N], b[N];
int p[N];
int root(int a) { return p[a] == a ? a : (p[a] = root(p[a])); }
void merge(int a, int b) {
  a = root(a), b = root(b);
  if (a != b) p[a] = b;
}
int main() {
  int m, n;
  scanf("%d%d", &m, &n);
  for (int i = 1; i <= n + m; i++) p[i] = i;
  for (int i = 1; i <= m; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) scanf("%d", &b[i]);
  vector<pair<int, pair<int, int> > > V;
  long long ans = 0;
  for (int i = 1; i <= m; i++) {
    int s, x;
    scanf("%d", &s);
    for (int j = 1; j <= s; j++) {
      scanf("%d", &x);
      V.emplace_back(make_pair(a[i] + b[x], make_pair(i, m + x)));
      ans += a[i] + b[x];
    }
  }
  sort((V).begin(), (V).end());
  reverse((V).begin(), (V).end());
  for (int i = 0; i < (int)V.size(); i++) {
    int val = V[i].first, u = V[i].second.first, v = V[i].second.second;
    if (root(u) == root(v)) continue;
    merge(u, v);
    ans -= val;
  }
  printf("%lld\n", ans);
}
