#include <bits/stdc++.h>
using namespace std;
template <typename T>
void read(T& x) {
  x = 0;
  char ch = getchar();
  long long f = 1;
  while (!isdigit(ch)) {
    if (ch == '-') f *= -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - 48;
    ch = getchar();
  }
  x *= f;
}
template <typename T, typename... Args>
void read(T& first, Args&... args) {
  read(first);
  read(args...);
}
template <typename T>
void write(T arg) {
  T x = arg;
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x > 9) {
    write(x / 10);
  }
  putchar(x % 10 + '0');
}
template <typename T, typename... Ts>
void write(T arg, Ts... args) {
  write(arg);
  if (sizeof...(args) != 0) {
    putchar(' ');
    write(args...);
  }
}
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
const int N = 1e5 + 5;
int n, m;
int a[N], b[N], fa[N << 1];
int cnt = 0;
long long res = 0;
struct node {
  int u, v, w;
  bool operator<(const node& no) const { return w > no.w; }
} edge[N << 1];
int findroot(int x) {
  if (fa[x] == x) return x;
  return fa[x] = findroot(fa[x]);
}
bool merge(int x, int y) {
  int fax = findroot(x);
  int fay = findroot(y);
  if (fax != fay) {
    fa[fax] = fay;
    return true;
  }
  return false;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> m >> n;
  int tot = 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++) {
    ++tot;
    int s;
    cin >> s;
    for (int j = 1; j <= s; j++) {
      int v;
      cin >> v;
      edge[++cnt].u = tot, edge[cnt].v = v, edge[cnt].w = a[i] + b[v];
      res += edge[cnt].w;
    }
  }
  sort(edge + 1, edge + 1 + cnt);
  for (int i = 1; i <= tot + 5; i++) fa[i] = i;
  for (int i = 1; i <= cnt; i++) {
    int u = edge[i].u, v = edge[i].v, w = edge[i].w;
    if (merge(u, v)) res -= w;
  }
  cout << res << endl;
}
