import sys #input = sys.stdin.readline input = sys.stdin.buffer.readline import math import copy from collections import defaultdict def main(): N,K = map(int,input().split()) A = list(map(int,input().split())) #dp[v]:vで割れる値 dp = defaultdict(int) dp[1] = 1 for i,a in enumerate(A): p = copy.copy(dp) p,dp = dp,p for v in p: nv = math.gcd(K,v*a) dp[nv] += p[v] ans = dp[K] print(ans) if __name__ == '__main__': main()