#include <bits/stdc++.h>
using namespace std;
const long long SIZE = 1e6 * 2 + 10, INF = 1e9 * 1e9 + 10;
vector<vector<long long>> el, gr;
long long dsu[SIZE];
long long par(int v) {
  if (dsu[v] == v)
    return v;
  else
    return dsu[v] = par(dsu[v]);
}
void uni(int v, int u) {
  u = par(u);
  v = par(v);
  if (u != v) {
    dsu[u] = v;
  }
}
int main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(0);
  ;
  long long n, m;
  cin >> m >> n;
  vector<long long> vec1(m), vec2(n);
  vector<pair<long long, long long>> srt;
  long long mx = 0;
  long long i = 0, s1 = 0, s2 = 0;
  for (auto &cur : vec1) {
    cin >> cur;
    srt.push_back({cur, i});
    i++;
  }
  for (auto &cur : vec2) {
    cin >> cur;
  }
  for (int i = 0; i < n; i++) dsu[i] = i;
  sort(srt.rbegin(), srt.rend());
  long long ans = 0;
  el.resize(m);
  for (int i = 0; i < m; i++) {
    long long sz;
    cin >> sz;
    el[i].resize(sz);
    for (int j = 0; j < sz; j++) {
      cin >> el[i][j];
      el[i][j]--;
    }
  }
  set<long long> us;
  gr.resize(m);
  long long dis = 0;
  for (int i = 0; i < m; i++) {
    long long mx = 0;
    for (auto cur : el[srt[i].second]) {
      ans += vec2[cur] + srt[i].first;
      if (us.find(cur) == us.end()) {
        dis += srt[i].first + vec2[cur];
        us.insert(cur);
        gr[srt[i].second].push_back(cur);
      }
    }
  }
  vector<tuple<long long, long long, long long>> edges;
  for (int i = 0; i < m; i++) {
    if (gr[i].size() == 0) {
      pair<long long, long long> mx = {-1, -1};
      for (auto cur : el[i]) mx = max(mx, {vec2[cur], cur});
      dis += vec1[i] + mx.first;
      gr[i].push_back(mx.second);
    }
  }
  for (int i = 0; i < m; i++) {
    set<long long> s;
    if (gr[i].size() == 0) continue;
    for (int j = 1; j < gr[i].size(); j++) {
      uni(gr[i][j], gr[i][j - 1]);
    }
    for (auto cur : gr[i]) s.insert(cur);
    for (auto cur : el[i]) {
      if (s.find(cur) == s.end()) {
        edges.push_back({vec1[i] + vec2[cur], cur, gr[i][0]});
      }
    }
  }
  sort(edges.rbegin(), edges.rend());
  for (auto cur : edges) {
    long long u = par(get<1>(cur)), v = par(get<2>(cur)), c = get<0>(cur);
    if (u != v) {
      uni(u, v);
      dis += c;
    }
  }
  cout << ans - dis;
  return 0;
}
