N, M = map(int, input().split()) A = sorted(list(map(int, input().split()))) S = set(A[1:]) used = set() ans = [] for i in range(1, N): if A[i] not in S: continue ans.append(A[i]) for j in range(A[i], M+1, A[i]): if j not in S and j not in used: exit(print(-1)) if j not in used: S.remove(j) used.add(j) print(len(ans)) print(*ans)