#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> cnt(404040);
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    cnt[a]++;
    sum += a;
  }
  for (int i = 1; i < (int) cnt.size(); i++) {
    cnt[i] += cnt[i - 1];
  }
  vector<int> b(m);
  vector<long long> memo(202020, -1);
  for (int i = 0; i < m; i++) {
    cin >> b[i];
  }
  long long ans = sum * m;
  for (int i = 0; i < m; i++) {
    if (memo[b[i]] != -1) {
      ans -= memo[b[i]];
      continue;
    }
    memo[b[i]] = 0;
    for (int x = 1; (x + 1) * b[i] - 1 < 404040; x++) {
      memo[b[i]] += 1LL * b[i] * x * (cnt[(x + 1) * b[i] - 1] - cnt[x * b[i] - 1]);
    }
    ans -= memo[b[i]];
  }
  cout << ans << endl;
  return 0;
}

