import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random #sys.setrecursionlimit(10**9) #sys.set_int_max_str_digits(0) #input = sys.stdin.readline #n = int(input()) # #alist = [] input = sys.stdin.readline n,m = map(int,input().split()) a = list(map(int,input().split())) a.sort() b = [] check = [0 for i in range(n)] check[0] = 1 c = collections.defaultdict(lambda :-1) for i in range(n): c[a[i]] = i for i in range(1,n): if check[i] == 0: x = a[i] while x <= m: check[c[x]] = 1 if c[x] == -1: exit(print(-1)) x += a[i] b.append(a[i]) print(len(b)) print(*b)