#include <bits/stdc++.h>
using namespace std;
struct Edge {
  int from, to, weight;
  bool operator<(Edge const& other) const { return weight > other.weight; }
};
int find(int x, int a[]) {
  if (x == a[x]) {
    return x;
  }
  a[x] = find(a[x], a);
  return a[x];
}
int main() {
  int m, n;
  cin >> m >> n;
  int a[m];
  int b[n];
  for (int i = 0; i < m; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &b[i]);
  }
  vector<int> A[m];
  vector<Edge> graph;
  long long total = 0;
  for (int i = 0; i < m; i++) {
    int s;
    scanf("%d", &s);
    A[i].resize(s);
    for (int j = 0; j < s; j++) {
      scanf("%d", &A[i][j]);
      int weight = a[i] + b[A[i][j] - 1];
      total += weight;
      int v = A[i][j] + m - 1;
      graph.push_back({i, v, weight});
    }
  }
  sort(graph.begin(), graph.end());
  int s = graph.size();
  int p[n + m];
  for (int i = 0; i < n + m; i++) {
    p[i] = i;
  }
  int x, y;
  for (int i = 0; i < s; i++) {
    x = find(graph[i].from, p);
    y = find(graph[i].to, p);
    if (x != y) {
      total -= graph[i].weight;
      p[x] = y;
    }
  }
  cout << total << endl;
  return 0;
}
