#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
template <class T>
void chmin(T &a, const T &b) {
  if (a > b) a = b;
}
template <class T>
void chmax(T &a, const T &b) {
  if (a < b) a = b;
}
class DisjointSet {
 public:
  int N;
  vector<int> rank, p;
  vector<int> sz;
  DisjointSet() {}
  DisjointSet(int n) : N(n), rank(n), p(n), sz(n) {
    for (int i = 0; i < N; i++) makeSet(i);
  }
  void makeSet(int x) {
    p[x] = x;
    rank[x] = 0;
    sz[x] = 1;
  }
  bool same(int x, int y) { return leader(x) == leader(y); }
  void unite(int x, int y) {
    if (same(x, y)) return;
    link(leader(x), leader(y));
  }
  void link(int x, int y) {
    if (rank[x] > rank[y]) {
      p[y] = x;
      sz[x] += sz[y];
    } else {
      p[x] = y;
      sz[y] += sz[x];
      if (rank[x] == rank[y]) {
        ++rank[y];
      }
    }
  }
  int leader(int x) {
    if (x != p[x]) p[x] = leader(p[x]);
    return p[x];
  }
  int size(int x) { return sz[leader(x)]; }
};
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int M, N;
  cin >> M >> N;
  vector<long long> A(M);
  for (int i = 0; i < (M); ++i) cin >> A[i];
  vector<long long> B(N);
  for (int i = 0; i < (N); ++i) cin >> B[i];
  vector<vector<int>> C(M);
  for (int i = 0; i < (M); ++i) {
    int s;
    cin >> s;
    C[i].resize(s);
    for (int j = 0; j < (s); ++j) {
      cin >> C[i][j];
      C[i][j]--;
    }
  }
  vector<tuple<long long, int, int>> edges;
  long long all = 0;
  for (int i = 0; i < M; i++) {
    for (auto n : C[i]) {
      all += A[i] + B[n];
      edges.push_back(make_tuple(A[i] + B[n], i, M + n));
    }
  }
  sort(edges.begin(), edges.end());
  reverse(edges.begin(), edges.end());
  long long ans = 0;
  DisjointSet us(M + N);
  for (int i = 0; i < (edges.size()); ++i) {
    int a = get<1>(edges[i]);
    int b = get<2>(edges[i]);
    long long c = get<0>(edges[i]);
    if (us.same(a, b)) continue;
    us.unite(a, b);
    ans += c;
  }
  cout << all - ans << endl;
  return 0;
}
