#include <bits/stdc++.h>
using namespace std;
int a[100005], b[100005], s[100005], p[200005];
vector<pair<int, pair<int, int> > > edges;
int get_root(int a) {
  if (p[a] == a) return a;
  return p[a] = get_root(p[a]);
}
void merge(int a, int b) {
  a = get_root(a), b = get_root(b);
  if (a != b) p[a] = b;
}
int main() {
  int m, n;
  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 <= m + n; i++) p[i] = i;
  long long ans = 0;
  for (int i = 1; i <= m; i++) {
    scanf("%d", &s[i]);
    for (int j = 1; j <= s[i]; j++) {
      int x;
      scanf("%d", &x);
      ans += a[i] + b[x];
      edges.emplace_back(make_pair(a[i] + b[x], make_pair(i, x + m)));
    }
  }
  sort(edges.begin(), edges.end());
  reverse(edges.begin(), edges.end());
  for (int i = 0; i < edges.size(); i++) {
    int val = edges[i].first;
    int x = edges[i].second.first, y = edges[i].second.second;
    if (get_root(x) != get_root(y)) {
      merge(x, y);
      ans -= val;
    }
  }
  printf("%lld\n", ans);
}
