#include <bits/stdc++.h>
using namespace std;
int const maxN = 1e5;
int const maxM = 1e5;
int main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  int M, N;
  cin >> M >> N;
  vector<int> CostA(M + 1), CostB(N + 1);
  for (int i = 1; i <= M; i++) {
    cin >> CostA[i];
  }
  for (int i = 1; i <= N; i++) {
    cin >> CostB[i];
  }
  vector<array<int, 3>> Edge;
  int64_t Res = 0;
  for (int i = 1; i <= M; i++) {
    int x;
    cin >> x;
    for (int j = 0; j < x; j++) {
      int y;
      cin >> y;
      Edge.push_back({i, M + y, CostA[i] + CostB[y]});
      Res += CostA[i] + CostB[y];
    }
  }
  sort(Edge.begin(), Edge.end(),
       [](array<int, 3> const& lhs, array<int, 3> const& rhs) {
         return lhs[2] > rhs[2];
       });
  struct Disjoint_Set_Union {
    vector<int> Par, Rank;
    int N;
    Disjoint_Set_Union(int N) : N(N) {
      Par.resize(N + 1);
      iota(Par.begin() + 1, Par.end(), 1);
      Rank.resize(N + 1);
    }
    int Find_Par(int u) { return Par[u] = Par[u] == u ? u : Find_Par(Par[u]); }
    bool Join(int u, int v) {
      u = Find_Par(u);
      v = Find_Par(v);
      if (u == v) {
        return 0;
      }
      if (Rank[u] == Rank[v]) {
        ++Rank[u];
      }
      if (Rank[u] < Rank[v]) {
        Par[u] = v;
      } else {
        Par[v] = u;
      }
      return 1;
    }
  } DSU(M + N);
  for (array<int, 3> e : Edge) {
    if (DSU.Join(e[0], e[1])) {
      Res -= e[2];
    }
  }
  cout << Res;
  return 0;
}
