#include using namespace std; const int MAX = 1e6; vector lp(1000010, 0), pr; struct Make_Table{ Make_Table(){ for(int i = 2; i <= MAX; i++){ if(!lp[i]){ lp[i] = i; pr.push_back(i); } for(int j = 0; j < (int)pr.size() and pr[j] <= lp[i] and i * pr[j] <= MAX; j++){ lp[i * pr[j]] = pr[j]; } } } }Make_Table_; long long res; int a; map mp; void solve(){ res -= a; mp.clear(); while(lp[a]){ mp[lp[a]]++; a = a / lp[a]; } if(a != 1) mp[a]++; int pre = 1; for(auto p : mp) pre *= pow(p.first, p.second - 1) * ((p.first - 1) * p.second + p.first); res += pre; } int main(){ int n, m; cin >> n >> m; while(cin >> a) solve(); cout << res << '\n'; }