N,M = map(int, input().split()) A = list(map(int, input().split())) A.sort() from collections import defaultdict d = defaultdict(lambda:0) s_A = set(A) ans = [] for i in A[1:]: if d[i] > 0: continue for j in range(i,M+1,i): if j not in s_A: print(-1) exit() else: d[j] += 1 ans.append(i) #print(d) print(len(ans)) print(*ans)