#include <bits/stdc++.h>
using namespace std;
int m, n, k, a[100000 + 10], b[100000 + 10], tata[2 * 100000 + 10],
    rang[2 * 100000 + 10];
long long total, ans;
struct date {
  int n1, n2;
  long long cost;
} A[2 * 100000 + 10];
inline bool mycmp(date a, date b) { return a.cost < b.cost; }
int findDaddy(int x) {
  int y = x, r = x;
  while (tata[r] != r) r = tata[r];
  while (tata[x] != x) {
    y = tata[x];
    tata[x] = r;
    x = y;
  }
  return r;
}
void unite(int x, int y) {
  if (rang[x] < rang[y])
    tata[x] = y;
  else
    tata[y] = x;
  if (rang[x] == rang[y]) rang[x]++;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> m >> n;
  for (int i = 1; i <= m; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) cin >> b[i];
  for (int i = 1; i <= m; i++) {
    int nr;
    cin >> nr;
    for (int j = 1; j <= nr; j++) {
      int x;
      cin >> x;
      k++;
      A[k].n1 = x;
      A[k].n2 = n + i;
      A[k].cost = -(a[i] + b[x]);
      total += a[i] + b[x];
    }
  }
  for (int i = 1; i <= n + m; i++) tata[i] = i, rang[i] = 1;
  sort(A + 1, A + k + 1, mycmp);
  for (int i = 1; i <= k; i++) {
    int val1 = findDaddy(A[i].n1), val2 = findDaddy(A[i].n2);
    if (val1 == val2) continue;
    ans += -A[i].cost;
    unite(val1, val2);
  }
  cout << total - ans << '\n';
  return 0;
}
