#include <bits/stdc++.h>
using namespace std;
void debug_out() { cout << '\n'; }
template <typename T, typename... R>
void debug_out(const T &f, const R &...r) {
  cout << f << " ";
  debug_out(r...);
}
template <typename A, typename B>
ostream &operator<<(ostream &out, const pair<A, B> &a) {
  out << "(" << a.first << "," << a.second << ")";
  return out;
}
template <typename Tuple, size_t N>
struct tuple_print {
  static void print(const Tuple &t, std::ostream &os) {
    tuple_print<Tuple, N - 1>::print(t, os);
    os << ", " << std::get<N - 1>(t);
  }
};
template <typename Tuple>
struct tuple_print<Tuple, 1> {
  static void print(const Tuple &t, std::ostream &os) {
    os << "(" << std::get<0>(t);
  }
};
template <typename... Args>
ostream &operator<<(ostream &os, const tuple<Args...> &t) {
  tuple_print<decltype(t), sizeof...(Args)>::print(t, os);
  return os << ")";
}
template <typename T>
ostream &operator<<(ostream &out, const vector<T> &a) {
  out << "[";
  bool first = true;
  for (auto &v : a) {
    out << (first ? "" : ", ");
    out << v;
    first = 0;
  }
  out << "]";
  return out;
}
template <typename T, class Cmp>
ostream &operator<<(ostream &out, const set<T, Cmp> &a) {
  out << "{";
  bool first = true;
  for (auto &v : a) {
    out << (first ? "" : ", ");
    out << v;
    first = 0;
  }
  out << "}";
  return out;
}
template <typename U, typename T, class Cmp>
ostream &operator<<(ostream &out, const map<U, T, Cmp> &a) {
  out << "{";
  bool first = true;
  for (auto &p : a) {
    out << (first ? "" : ", ");
    out << p.first << ":" << p.second;
    first = 0;
  }
  out << "}";
  return out;
}
template <typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&...args) {
  const char *comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
const long long mod = 1e9 + 7;
const int N = 1e6 + 100;
int T;
int m, n;
long long a[N], b[N];
int fa[N], s, x;
tuple<int, int, long long> edge[N];
int getfa(int xx) {
  if (xx == fa[xx]) return xx;
  return fa[xx] = getfa(fa[xx]);
}
int main() {
  ios::sync_with_stdio(false);
  cin >> m >> n;
  for (int i = 1; i <= m; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) cin >> b[i];
  int all = 0;
  long long sum = 0;
  for (int i = 1; i <= m; i++) {
    cin >> s;
    for (int j = 1; j <= s; j++) {
      cin >> x;
      edge[++all] = make_tuple(n + i, x, a[i] + b[x]);
      sum += a[i] + b[x];
    }
  }
  sort(edge + 1, edge + all + 1,
       [&](tuple<int, int, long long> aa, tuple<int, int, long long> bb) {
         return get<2>(aa) > get<2>(bb);
       });
  for (int i = 1; i <= n + m; i++) fa[i] = i;
  long long ans = 0;
  for (int i = 1; i <= all; i++) {
    int yy = getfa(get<1>(edge[i]));
    int xx = getfa(get<0>(edge[i]));
    if (xx == yy) continue;
    fa[xx] = yy;
    ans += get<2>(edge[i]);
  }
  cout << sum - ans;
  return 0;
}
