#include <bits/stdc++.h>
using namespace std;
const int MaxN = 100003;
int a[MaxN], b[MaxN];
int n, m, k;
int R[MaxN];
int Nv[MaxN], Ne[MaxN];
int* C[MaxN];
int r, rx, ry;
int s, y, c = 0;
long long int cost = 0;
typedef struct {
  int x, y, w;
} edge;
edge E[2 * MaxN];
int root(int x) { return (x == R[x]) ? x : R[x] = root(R[x]); }
int cmp(const void* a, const void* b) {
  edge* e1 = (edge*)a;
  edge* e2 = (edge*)b;
  if (e1->w < e2->w) return 1;
  if (e1->w == e2->w) return 0;
  if (e1->w > e2->w) return -1;
}
bool add(int x, int y) {
  rx = root(x);
  ry = root(y);
  if (rx == ry) return true;
  if (rx < ry)
    R[ry] = R[rx];
  else
    R[rx] = R[ry];
  return false;
}
int main() {
  scanf("%d %d", &m, &n);
  for (int i = 0; i < m; i++) scanf("%d", &a[i]);
  for (int i = 0; i < n; i++) scanf("%d", &b[i]);
  for (int i = 0; i < m; i++) {
    scanf("%d", &s);
    for (int j = 0; j < s; j++) {
      scanf("%d", &y);
      edge e;
      e.x = i;
      e.y = m + y - 1;
      e.w = a[i] + b[y - 1];
      E[c++] = e;
    }
  }
  qsort(E, c, sizeof(edge), cmp);
  for (int i = 0; i < m + n; i++) R[i] = i;
  for (int i = 0; i < c; i++)
    if (add(E[i].x, E[i].y)) cost += E[i].w;
  printf("%lld\n", cost);
}
