#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
const int base = 31337;
const int mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const int logo = 20;
const int off = 1 << logo;
const int treesiz = off << 1;
int n, m;
int a[maxn], b[maxn];
int parr[maxn];
vector<pair<int, pair<int, int>>> v;
int fin(int x) {
  if (x == parr[x])
    return x;
  else
    return parr[x] = fin(parr[x]);
}
void merg(int x, int y) {
  x = fin(x);
  y = fin(y);
  int ra = rand() % 2;
  if (ra == 0)
    parr[x] = y;
  else
    parr[y] = x;
}
int main() {
  srand(time(0));
  scanf("%d%d", &m, &n);
  for (int i = 0; i < m; i++) scanf("%d", a + i);
  for (int i = 0; i < n; i++) scanf("%d", b + i);
  for (int i = 0; i < m; i++) {
    int x;
    scanf("%d", &x);
    for (int j = 0; j < x; j++) {
      int tren;
      scanf("%d", &tren);
      int cost = a[i] + b[tren - 1];
      v.push_back(make_pair(cost, make_pair(i, tren + m - 1)));
    }
  }
  for (int i = 0; i < n + m; i++) parr[i] = i;
  sort(v.rbegin(), v.rend());
  long long sol = 0;
  for (int i = 0; i < v.size(); i++) {
    int cost = v[i].first;
    int x = v[i].second.first;
    int y = v[i].second.second;
    if (fin(x) == fin(y))
      sol += cost;
    else
      merg(x, y);
  }
  printf("%lld\n", sol);
  return 0;
}
