#include <bits/stdc++.h>
using namespace std;
template <class T>
void read(T &num) {
  char CH;
  bool F = false;
  for (CH = getchar(); CH < '0' || CH > '9'; F = CH == '-', CH = getchar())
    ;
  for (num = 0; CH >= '0' && CH <= '9';
       num = num * 10 + CH - '0', CH = getchar())
    ;
  F && (num = -num);
}
const int maxn = 1e6 + 100;
const int maxm = 3e6 + 100;
const int inf = 0x3f3f3f3f;
const long long INF = ~0ULL >> 1;
const long long mod = 1e9 + 7;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
inline long long mul(long long a, long long b) {
  long long c = a * b - (long long)((long double)a * b / mod + 0.5) * mod;
  return c < 0 ? c + mod : c;
}
int fa[maxn], n, m;
struct E {
  int x, y;
  long long w;
} e[maxn];
struct rule {
  bool operator()(const E &a, const E &b) { return a.w > b.w; }
};
int find(int x) { return fa[x] == x ? x : fa[x] = find(fa[x]); }
long long krusta(int k) {
  long long ans = 0;
  int cnt = 0;
  sort(e + 1, e + 1 + k, rule());
  for (int i = 1; i <= k; i++) {
    int fx = find(e[i].x), fy = find(e[i].y);
    if (fx == fy) continue;
    fa[fx] = fy;
    cnt++;
    ans += e[i].w;
    if (cnt >= n + m - 1) return ans;
  }
  return ans;
}
long long a[maxn], b[maxn];
int main() {
  int cnt = 0;
  long long ans = 0;
  scanf("%d %d", &m, &n);
  for (int i = 1; i <= m; i++) scanf("%lld", &a[i]);
  for (int i = 1; i <= n; i++) scanf("%lld", &b[i]);
  for (int i = 1; i <= m; i++) {
    int x;
    scanf("%d", &x);
    while (x--) {
      int y;
      scanf("%d", &y);
      e[++cnt] = (E){i + n, y, a[i] + b[y]};
      ans += a[i] + b[y];
    }
  }
  for (int i = 1; i <= n + m; i++) fa[i] = i;
  printf("%lld\n", ans - krusta(cnt));
}
