N,K=map(int,input().split()) A=list(map(int,input().split())) A.sort() L=[K] for i in range(N-1,0,-1): a=A[i] for x in L[:]: if x>a: L.append(x%a) ans=0 for x in L: alt=x%A[0] if ans