#include <bits/stdc++.h>
using namespace std;
mt19937 rnd(time(0));
const long long inf = 0x3f3f3f3f3f3f3f3fLL;
const long long N = 1e5 + 5;
const long long MOD = 1e9 + 7;
long long n, m;
long long a[N], b[N], par[2 * N];
vector<long long> g[2 * N];
vector<tuple<long long, long long, long long>> e;
long long find(long long x) {
  if (par[x] == x) return x;
  return par[x] = find(par[x]);
}
void uni(long long x, long long y) {
  x = find(x);
  y = find(y);
  par[x] = y;
}
void findMaxMST(long long &w) {
  vector<long long> o(e.size());
  iota(o.begin(), o.end(), 0LL);
  sort(o.begin(), o.end(),
       [&](long long i, long long j) { return get<2>(e[i]) > get<2>(e[j]); });
  for (long long i = 1; i <= n + m; i++) {
    par[i] = i;
  }
  w = 0;
  for (auto i : o) {
    long long u = get<0>(e[i]);
    long long v = get<1>(e[i]);
    if (find(u) != find(v)) {
      uni(u, v);
      w += get<2>(e[i]);
    }
  }
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> m >> n;
  for (long long i = 1; i <= m; i++) cin >> a[i];
  for (long long j = 1; j <= n; j++) cin >> b[j];
  long long tot = 0, sz, idx = 0, v;
  for (long long u = 1; u <= m; u++) {
    cin >> sz;
    for (long long j = 0; j < sz; j++) {
      cin >> v;
      g[u].push_back(idx);
      g[m + v].push_back(idx++);
      e.emplace_back(u, m + v, a[u] + b[v]);
      tot += a[u] + b[v];
    }
  }
  long long w = 0;
  findMaxMST(w);
  cout << tot - w;
  return 0;
}
