#include #include using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf 1000000001 int main(){ int N,M; cin>>N>>M; vector temp(N+1,0LL); for(int i=1;i<=N;i++){ temp[i] += i; for(int j=i*2;j<=N;j+=i){ temp[j] -= temp[i]; } } vector ans(N+1,0); for(int i=1;i<=N;i++){ for(int j=i;j<=N;j+=i){ ans[j] += temp[i] * (j/i); } } long long Ans = 0LL; rep(i,M){ int A; scanf("%d",&A); Ans += ans[A] - A; } cout<