#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
const int mod = 1e9 + 7;
const int maxn = 3e5 + 10;
const int inf = 0x3f3f3f3f;
int n, m;
ll a[maxn], b[maxn];
struct edge {
  int u, v;
  ll cost;
  friend bool operator<(edge a, edge b) { return a.cost > b.cost; }
};
vector<edge> g;
int fa[maxn];
int Find(int x) {
  if (x == fa[x]) return x;
  return fa[x] = Find(fa[x]);
}
void Union(int a, int b) { fa[Find(b)] = Find(a); }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> m >> n;
  for (int i = (1); i <= (int)(m); i++) cin >> a[i];
  for (int i = (1); i <= (int)(n); i++) cin >> b[i];
  ll ans = 0;
  for (int i = (1); i <= (int)(m); i++) {
    int num;
    cin >> num;
    while (num--) {
      int x;
      cin >> x;
      g.push_back({i, m + x, a[i] + b[x]});
      ans += a[i] + b[x];
    }
  }
  sort(g.begin(), g.end());
  for (int i = (1); i <= (int)(n + m); i++) fa[i] = i;
  for (auto x : g) {
    if (Find(x.u) == Find(x.v)) continue;
    Union(x.u, x.v);
    ans -= x.cost;
  }
  cout << ans << '\n';
  return 0;
}
