def div(n): S = set() i = 1 while i * i <= n: if n % i == 0: S.add(i) S.add(n // i) i += 1 return S N, M = map(int, input().split()) A = list(map(int, input().split())) D = [0] * (N + 1) for a in A: D[a] += 1 ans = 0 E = [0] * (N + 1) for i in range(N, 0, -1): if D[i] == E[i]: ans += 1 else: for d in div(i): E[d] = 1 - E[d] print(ans)