N,M = map(int,input().split()) A = sorted(list(map(int,input().split()))) C = {} for i in range(1,N): C[A[i]] = 0 B = [] flag = 1 for i in range(1,N): if C[A[i]]==0: C[A[i]] = 1 B.append(A[i]) for j in range(2*A[i],M+1,A[i]): if j not in C: flag = -1 break C[j] = 1 if flag==-1:break if flag==-1: print(flag) else: print(len(B)) print(*B)