#include <bits/stdc++.h>
using namespace std;
const int N = 200000;
int n, m, a[N + 9], b[N + 9];
struct gg {
  int id, x;
  gg(int Id = 0, int X = 0) {
    id = Id;
    x = X;
  }
} d[N + 9];
int cd;
long long sum;
bool cmp(gg u, gg v) { return a[u.id] + b[u.x] > a[v.id] + b[v.x]; }
void into() {
  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; ++i) {
    int len;
    scanf("%d", &len);
    for (int j = 0; j < len; ++j) {
      int x;
      scanf("%d", &x);
      d[++cd] = gg(i, x);
      sum += a[i] + b[x];
    }
  }
}
int uni[N + 9];
int Query_uni(int k) { return k == uni[k] ? k : uni[k] = Query_uni(uni[k]); }
long long ans;
void Get_ans() {
  sort(d + 1, d + cd + 1, cmp);
  for (int i = 1; i <= n + m; ++i) uni[i] = i;
  for (int i = 1; i <= cd; ++i) {
    int fx = Query_uni(d[i].id + n), fy = Query_uni(d[i].x);
    if (fx == fy) continue;
    uni[fx] = fy;
    ans += a[d[i].id] + b[d[i].x];
  }
}
void work() { Get_ans(); }
void outo() { printf("%lld\n", sum - ans); }
int main() {
  int T = 1;
  for (; T--;) {
    into();
    work();
    outo();
  }
  return 0;
}
