N,M = map(int,input().split()) B = list(map(int,input().split())) B.sort() check = [False for i in range(M+1)] done = [False for i in range(M+1)] for i in B: check[i] = True done[i] = True check[0] = False done[0] = False state = True out = [] for i in range(1,N): i = B[i] if done[i]: out.append(i) for j in range(i,M+1,i): if not check[j]: state = False done[j] = False if state: print(len(out)) [print(i, end=" ") for i in out] else:print(-1)