#include <bits/stdc++.h>
using namespace std;
const int maxm = 100001;
long long m = 998244353;
vector<vector<pair<int, int>>> adj;
vector<int> h;
vector<int> vis;
vector<int> a, b;
priority_queue<pair<int, int>, vector<pair<int, int>>> edge;
long long ans = 0;
void buildGraph(int n, int m) {
  adj = vector<vector<pair<int, int>>>(n + m + 1);
  a = vector<int>(m + 1);
  b = vector<int>(n + 1);
  vis = vector<int>(n + m + 1);
  for (int i = 1; i <= m; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> b[i];
  }
  for (int i = 1; i <= m; i++) {
    int len;
    cin >> len;
    for (int j = 1; j <= len; j++) {
      int c;
      cin >> c;
      adj[n + i].push_back(make_pair(c, a[i] + b[c]));
      adj[c].push_back(make_pair(n + i, a[i] + b[c]));
      ans += a[i] + b[c];
    }
  }
}
void solve() {
  int n, m;
  cin >> m >> n;
  buildGraph(n, m);
  long long cost = 0;
  for (int i = 1; i <= m + n; i++) {
    if (vis[i]) continue;
    edge.push(make_pair(0, i));
    while (edge.size()) {
      int val = edge.top().first;
      int top = edge.top().second;
      edge.pop();
      if (vis[top]) continue;
      cost += val;
      vis[top] = 1;
      for (const auto &v : adj[top]) {
        if (vis[v.first]) continue;
        edge.push(make_pair(v.second, v.first));
      }
    }
  }
  cout << ans - cost << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  ;
  int test;
  test = 1;
  while (test--) {
    solve();
  }
  return 0;
}
