import itertools
N, X = map(int, input().split())
S = list(map(int, input().split()))
ans = 0

for tpl in itertools.permutations(S):
    x = X
    if 1 in tpl:
        continue

    for y in tpl:
        x = x % y
        if x == 0 or x == 1:
            break
    ans += x
print(ans % (10**9 + 7))