#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
const int inf = 0x3f3f3f3f;
const int mod = 998244353;
const int M = 1 << 17 << 1;
int m, n, a[N], b[N];
int f[N];
struct edge {
  int u, v, w;
  edge(int _u, int _v, int _w) { u = _u, v = _v, w = _w; }
  edge(){};
};
vector<edge> e;
int find(int x) { return x == f[x] ? x : f[x] = find(f[x]); }
bool cmp(edge x, edge y) { return x.w > y.w; }
int main() {
  long long sum = 0;
  scanf("%d%d", &m, &n);
  for (int i = (1); i < (m + 1); i++) scanf("%d", &a[i]);
  for (int i = (1); i < (n + 1); i++) scanf("%d", &b[i]);
  for (int i = (1); i < (m + n); i++) f[i] = i;
  int cnt, x;
  for (int i = (1); i < (m + 1); i++) {
    scanf("%d", &cnt);
    while (cnt--) {
      scanf("%d", &x);
      e.push_back(edge(x, n + i, a[i] + b[x]));
      sum += a[i] + b[x];
    }
  }
  sort(e.begin(), e.end(), cmp);
  for (auto it : e) {
    int fx = find(it.u), fy = find(it.v);
    if (fx == fy) continue;
    sum -= it.w;
    f[fx] = fy;
  }
  printf("%I64d", sum);
  return 0;
}
