N, C = [int(x) for x in input().split()]
time = list()
periods = list()
for i in range(N):
periods.append(int(input()))
for i in range(1, C+1):
for p in periods:
if i % p == 0:
time.append(i)
print(len(set(time)))
N, C = map(int, input().split())
check = [False]*(C+1)
ans = 0
for _ in range(N):
n = int(input())
for i in range(n, C+1, n):
if not check[i]:
check[i] = True
ans += 1
print(ans)