#include <bits/stdc++.h>
using namespace std;
const int maxn = 200010;
int n, m, a[maxn], b[maxn], fa[maxn];
int find(int x) { return x == fa[x] ? x : fa[x] = find(fa[x]); }
int main() {
  scanf("%d %d", &m, &n);
  for (int i = 1; i <= m; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &b[i]);
  }
  for (int i = 1; i <= n + m; i++) {
    fa[i] = i;
  }
  vector<tuple<int, int, int>> E;
  long long sum = 0;
  for (int i = 1, k; i <= m; i++) {
    scanf("%d", &k);
    for (int j = 1, x; j <= k; j++) {
      scanf("%d", &x);
      E.emplace_back(a[i] + b[x], i, x + m);
      sum += a[i] + b[x];
    }
  }
  sort(E.begin(), E.end(), greater<tuple<int, int, int>>());
  for (auto e : E) {
    int u = find(get<1>(e)), v = find(get<2>(e));
    if (u == v) continue;
    fa[u] = v, sum -= get<0>(e);
  }
  printf("%lld\n", sum);
  return 0;
}
