#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
struct edge {
  int from, to, cost;
};
int n, m;
ll all, mst;
vi a, b, p;
vector<edge> g;
int findp(int u) { return (p[u] == u ? u : (p[u] = findp(p[u]))); }
inline bool uni(int u, int v) {
  u = findp(u);
  v = findp(v);
  if (u == v) return 0;
  p[v] = u;
  return 1;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> m >> n;
  a.resize(m);
  b.resize(n);
  p.resize(n + m);
  g.reserve(200005);
  iota(p.begin(), p.end(), 0);
  for (int& x : a) cin >> x;
  for (int& x : b) cin >> x;
  for (int i = 0; i < m; i++) {
    int sz;
    cin >> sz;
    edge e;
    e.to = i + n;
    while (sz--) {
      cin >> e.from;
      e.from--;
      e.cost = a[i] + b[e.from];
      all += e.cost;
      g.push_back(e);
    }
  }
  sort(g.begin(), g.end(), [](edge a, edge b) { return a.cost > b.cost; });
  for (edge e : g) {
    if (uni(e.from, e.to)) mst += e.cost;
  }
  cout << all - mst << '\n';
}
