#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 100000;
long long n, m;
long long a[MAXN + 1];
long long b[MAXN + 1];
long long dsu[MAXN * 2 + 1];
long long s;
long long c;
struct edge {
  long long a, b, v;
  edge() {}
  edge(long long _a, long long _b, long long _v) { a = _a, b = _b, v = _v; }
} edges[MAXN * 3];
long long cnt;
long long ans;
long long fnd(long long a) { return a == dsu[a] ? a : dsu[a] = fnd(dsu[a]); }
void Union(long long a, long long b) { dsu[fnd(a)] = fnd(b); }
signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cin >> m >> n;
  for (long long i = 1; i <= m; i++) cin >> a[i];
  for (long long i = 1; i <= n; i++) cin >> b[i];
  for (long long i = 1; i <= MAXN + n; i++) dsu[i] = i;
  for (long long i = 1; i <= m; i++) {
    cin >> s;
    for (long long j = 1; j <= s; j++) {
      cin >> c;
      edges[cnt++] = edge(i, MAXN + c, a[i] + b[c]);
      ans += a[i] + b[c];
    }
  }
  sort(edges, edges + cnt,
       [](const edge x, const edge y) { return x.v > y.v; });
  for (long long i = 0; i < cnt; i++) {
    if (fnd(edges[i].a) != fnd(edges[i].b)) {
      ans -= edges[i].v;
      Union(edges[i].a, edges[i].b);
    }
  }
  cout << ans << "\n";
}
