#include <cstdio>
#include <algorithm>
#include <set>
using namespace std;
int n,m;
const int mod = 1000000007;
long long fact[2030000];
long long ifact[2030000];
long long invs[2030000];
long long counts[1000030];
int main(){
invs[1] = 1;
for(int i = 2; i <= 400010; i++) invs[i] = (invs[mod%i] * (mod-mod/i)) % mod;
fact[0] = 1;
for(int i = 1; i <= 400010; i++) fact[i] = i * fact[i-1] % mod;
ifact[0] = 1;
for(int i = 1; i <= 400010; i++) ifact[i] = (invs[i] * ifact[i-1]) % mod;
scanf("%d%d",&n,&m);
for(int i = 1; i <= 200000; i++) {
counts[i] += fact[i+(n-2)] * ifact[n-1] % mod * ifact[i-1] % mod;
counts[i] %= mod;
for(int j = i*2; j <= 200000; j += i) {
counts[j] -= counts[i];
}
}
set<int> tmp;
long long ans = 0;
for(int i = 0; i < m; i++) {
int x;
scanf("%d",&x);
ans += counts[x];
if (tmp.insert(x).second == false) {
for(;;);
}
}
ans %= mod;
ans += mod;
ans %= mod;
printf("%lld\n", ans);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
56600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |