from collections import Counter as C N, M = map(int, input().split()) A = [int(a) for a in input().split()] X = [-1] * (N+1) L = [[] for _ in range(N+1)] k = 2 while k <= N: X[k] = 1 L[k].append(k) for i in range(k*2, N+1, k): X[i] = 0 L[i].append(k) d = 2 while k**d <= N: for i in range(k**d, N+1, k**d): L[i].append(k) d += 1 while k <= N and X[k] >= 0: k += 1 P = [i for i in range(N+1) if X[i] == 1] def calc(n): s = 1 l = C(L[n]) for p in l: s = s * p ** (l[p] - 1) * ((p - 1) * (l[p] + 1) + 1) return s ans = - sum(A) for a in A: ans += calc(a) print(ans)