if __name__=='__main__':
n,m = map(int,input().split())
p = list(map(int,input().split()))
res = 0
for i in range(1,1<<m):
t, cnt = 1, 0
for j in range(m):
if i >> j & 1:
cnt += 1
if t * p[j] > n:
t = -1
break
t *= p[j]
if t != -1:
if cnt % 2 :
res += n // t
else:
res -= n // t
print(res)