N, M = map(int, input().split()) A = set(map(int, input().split())) state = [0]*(N+1) for i in range(N, 0, -1): for j in range(i, N+1, i): state[i] ^= 1 ans = [0]*(N+1) for i in range(N, 0, -1): v = state[i] for j in range(2*i, N+1, i): v ^= ans[j] if (i in A) ^ v: ans[i] = 1 print(sum(ans))