#!usr/bin/env python3

from collections import defaultdict,deque

from heapq import heappush, heappop

import sys

import math

import bisect

import random

def LI(): return [int(x) for x in sys.stdin.readline().split()]

def I(): return int(sys.stdin.readline())

def LS():return [list(x) for x in sys.stdin.readline().split()]

def S():

    res = list(sys.stdin.readline())

    if res[-1] == "\n":

        return res[:-1]

    return res

def IR(n):

    return [I() for i in range(n)]

def LIR(n):

    return [LI() for i in range(n)]

def SR(n):

    return [S() for i in range(n)]

def LSR(n):

    return [LS() for i in range(n)]



sys.setrecursionlimit(1000000)

mod = 1000000007





# 挿入dp

def solve():

    n,x = LI()

    s = LI()

    s.sort()

    dp = [[0]*(x+1) for i in range(n+1)] # dp[i][j] := スタート時点の値がjの時に最初のi個の順列すべてを試し、えられる総和

    for j in range(x+1):

        dp[0][j] = j # dpの定義より明らか

        for i in range(n):

            si = s[i]

            ni = i+1

            nd = dp[i][j%si] # 先頭にsiを挿入 (スタートの値がj%siとなる)

            nd += i*dp[i][j] # 先頭以外にsiを挿入 (スタートの値も間の値も変わらない)

            dp[ni][j] += nd

            if dp[ni][j] >= mod:

                dp[ni][j] %= mod

    print((dp[n][x]))

    return



#Solve

if __name__ == "__main__":

    solve()

#!usr/bin/env python3

from collections import defaultdict,deque

from heapq import heappush, heappop

import sys

import math

import bisect

import random

def LI(): return [int(x) for x in sys.stdin.readline().split()]

def I(): return int(sys.stdin.readline())

def LS():return [list(x) for x in sys.stdin.readline().split()]

def S():

    res = list(sys.stdin.readline())

    if res[-1] == "\n":

        return res[:-1]

    return res

def IR(n):

    return [I() for i in range(n)]

def LIR(n):

    return [LI() for i in range(n)]

def SR(n):

    return [S() for i in range(n)]

def LSR(n):

    return [LS() for i in range(n)]



sys.setrecursionlimit(1000000)

mod = 1000000007





# 挿入dp

def solve():

    n,x = LI()

    s = LI()

    s.sort()

    dp = [[0]*(x+1) for i in range(n+1)] # dp[i][j] := スタート時点の値がjの時に最初のi個の順列すべてを試し、えられる総和

    for j in range(x+1):

        dp[0][j] = j # dpの定義より明らか

        for i in range(n):

            si = s[i]

            ni = i+1

            nd = dp[i][j%si] # 先頭にsiを挿入 (スタートの値がj%siとなる)

            nd += i*dp[i][j] # 先頭以外にsiを挿入 (スタートの値も間の値も変わらない)

            dp[ni][j] += nd

            if dp[ni][j] >= mod:

                dp[ni][j] %= mod

    print((dp[n][x]))

    return



# 空間の節約

def solve_1():

    n,x = LI()

    s = LI()

    s.sort()

    #dp = [[0]*(x+1) for i in range(n+1)] # dp[i][j] := スタート時点の値がjの時に最初のi個の順列すべてを試し、えられる総和

    dp = [j for j in range(x+1)]

    for i in range(n):

        si = s[i]

        ndp = [0]*(x+1)

        for j in range(x+1):

            nd = dp[j%si] # 先頭にsiを挿入 (スタートの値がj%siとなる)

            nd += i*dp[j] # 先頭以外にsiを挿入 (スタートの値も間の値も変わらない)

            ndp[j] += nd

            if ndp[j] >= mod:

                ndp[j] %= mod

        dp = [j for j in ndp]

    print((dp[x]))

    return



#Solve

if __name__ == "__main__":

    solve_1()

#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random


def LI():
    return [int(x) for x in sys.stdin.readline().split()]


def I():
    return int(sys.stdin.readline())


def LS():
    return [list(x) for x in sys.stdin.readline().split()]


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


sys.setrecursionlimit(1000000)
mod = 1000000007
# 挿入dp
def solve():
    n, x = LI()
    s = LI()
    s.sort()
    dp = [
        [0] * (x + 1) for i in range(n + 1)
    ]  # dp[i][j] := スタート時点の値がjの時に最初のi個の順列すべてを試し、えられる総和
    for j in range(x + 1):
        dp[0][j] = j  # dpの定義より明らか
        for i in range(n):
            si = s[i]
            ni = i + 1
            nd = dp[i][j % si]  # 先頭にsiを挿入 (スタートの値がj%siとなる)
            nd += i * dp[i][j]  # 先頭以外にsiを挿入 (スタートの値も間の値も変わらない)
            dp[ni][j] += nd
            if dp[ni][j] >= mod:
                dp[ni][j] %= mod
    print((dp[n][x]))
    return


# Solve
if __name__ == "__main__":
    solve()

#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random


def LI():
    return [int(x) for x in sys.stdin.readline().split()]


def I():
    return int(sys.stdin.readline())


def LS():
    return [list(x) for x in sys.stdin.readline().split()]


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


sys.setrecursionlimit(1000000)
mod = 1000000007
# 挿入dp
def solve():
    n, x = LI()
    s = LI()
    s.sort()
    dp = [
        [0] * (x + 1) for i in range(n + 1)
    ]  # dp[i][j] := スタート時点の値がjの時に最初のi個の順列すべてを試し、えられる総和
    for j in range(x + 1):
        dp[0][j] = j  # dpの定義より明らか
        for i in range(n):
            si = s[i]
            ni = i + 1
            nd = dp[i][j % si]  # 先頭にsiを挿入 (スタートの値がj%siとなる)
            nd += i * dp[i][j]  # 先頭以外にsiを挿入 (スタートの値も間の値も変わらない)
            dp[ni][j] += nd
            if dp[ni][j] >= mod:
                dp[ni][j] %= mod
    print((dp[n][x]))
    return


# 空間の節約
def solve_1():
    n, x = LI()
    s = LI()
    s.sort()
    # dp = [[0]*(x+1) for i in range(n+1)] # dp[i][j] := スタート時点の値がjの時に最初のi個の順列すべてを試し、えられる総和
    dp = [j for j in range(x + 1)]
    for i in range(n):
        si = s[i]
        ndp = [0] * (x + 1)
        for j in range(x + 1):
            nd = dp[j % si]  # 先頭にsiを挿入 (スタートの値がj%siとなる)
            nd += i * dp[j]  # 先頭以外にsiを挿入 (スタートの値も間の値も変わらない)
            ndp[j] += nd
            if ndp[j] >= mod:
                ndp[j] %= mod
        dp = [j for j in ndp]
    print((dp[x]))
    return


# Solve
if __name__ == "__main__":
    solve_1()

+# 空間の節約 +def solve_1(): +    n, x = LI() +    s = LI() +    s.sort() +    # dp = [[0]*(x+1) for i in range(n+1)] # dp[i][j] := スタート時点の値がjの時に最初のi個の順列すべてを試し、えられる総和 +    dp = [j for j in range(x + 1)] +    for i in range(n): +        si = s[i] +        ndp = [0] * (x + 1) +        for j in range(x + 1): +            nd = dp[j % si]  # 先頭にsiを挿入 (スタートの値がj%siとなる) +            nd += i * dp[j]  # 先頭以外にsiを挿入 (スタートの値も間の値も変わらない) +            ndp[j] += nd +            if ndp[j] >= mod: +                ndp[j] %= mod +        dp = [j for j in ndp] +    print((dp[x])) +    return + + -    solve() +    solve_1()