#include <bits/stdc++.h>
using namespace std;
const int MAX = 2e5 + 10;
int m, n, C;
long long ans = 0;
int a[MAX], b[MAX];
int fat[MAX], siz[MAX];
vector<pair<int, pair<int, int>>> Edges;
void start() {
  for (int i = 1; i <= C + m; i++) {
    fat[i] = i;
    siz[i] = 1;
  }
}
int find(int x) { return ((fat[x] == x) ? x : fat[x] = find(fat[x])); }
bool join(int x, int y) {
  x = find(x);
  y = find(y);
  if (x == y) return 0;
  if (siz[x] < siz[y]) {
    swap(x, y);
  }
  fat[y] = x;
  siz[x] += siz[y];
  return 1;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> m >> n;
  C = n + 1;
  start();
  for (int i = 0; i < m; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }
  for (int i = 0; i < m; i++) {
    int x;
    cin >> x;
    while (x--) {
      int y;
      cin >> y;
      ans += (a[i] + b[y - 1]);
      Edges.push_back({-a[i] - b[y - 1], {y - 1, i + C}});
    }
  }
  sort(Edges.begin(), Edges.end());
  for (auto it : Edges) {
    if (join(it.second.first, it.second.second)) {
      ans += it.first;
    }
  }
  cout << ans << "\n";
  return 0;
}
