#include <bits/stdc++.h>
using namespace std;
struct UnionFind {
  vector<int> par;
  UnionFind(int n) : par(n, -1) {}
  void init(int n) { par.assign(n, -1); }
  int root(int x) {
    if (par[x] < 0)
      return x;
    else
      return par[x] = root(par[x]);
  }
  bool issame(int x, int y) { return root(x) == root(y); }
  bool merge(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y) return false;
    if (par[x] > par[y]) swap(x, y);
    par[x] += par[y];
    par[y] = x;
    return true;
  }
  int size(int x) { return -par[root(x)]; }
};
int main() {
  int m, n;
  cin >> m >> n;
  vector<long long> a(m), b(n);
  for (int i = 0; i < m; ++i) cin >> a[i];
  for (int j = 0; j < n; ++j) cin >> b[j];
  UnionFind uf(m + n);
  vector<pair<long long, pair<int, int>>> edges;
  long long sum = 0;
  for (int i = 0; i < m; i++) {
    int s;
    cin >> s;
    for (int j = 0; j < s; j++) {
      int v;
      cin >> v;
      --v;
      edges.push_back({a[i] + b[v], {i, v + m}});
      sum += a[i] + b[v];
    }
  }
  sort(edges.rbegin(), edges.rend());
  long long res = 0;
  for (auto e : edges) {
    int u = e.second.first, v = e.second.second;
    if (uf.issame(u, v)) continue;
    res += e.first;
    uf.merge(u, v);
  }
  cout << sum - res << endl;
  return 0;
}
