#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const int inf = 1e9;
int n, m;
int a[100010];
int b[100010];
int p[100010];
vector<pair<int, pair<int, int>>> v;
vector<int> g[100010];
int Find(int a) { return p[a] ? p[a] = Find(p[a]) : a; }
void Union(int a, int b) { p[Find(b)] = Find(a); }
int main() {
  cin >> m >> n;
  for (int i = 1; i <= m; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> b[i];
  }
  long long ans = 0;
  for (int i = 1; i <= m; i++) {
    int sz;
    cin >> sz;
    for (int j = 1; j <= sz; j++) {
      int x;
      cin >> x;
      ans += a[i] + b[x];
      v.emplace_back(-a[i] - b[x], make_pair(i, x));
    }
  }
  sort((v).begin(), (v).end());
  for (auto i : v) {
    if (g[i.second.first].size() &&
        Find(g[i.second.first].back()) == Find(i.second.second))
      continue;
    if (g[i.second.first].size())
      Union(g[i.second.first].back(), i.second.second);
    ans += i.first;
    g[i.second.first].emplace_back(i.second.second);
  }
  cout << ans << "\n";
}
