Problem: Diana loves playing with numbers. She's got n cards with positive integer numbers a_i written on them. She spends her free time multiplying the numbers on the cards. She picks a non-empty subset of the cards and multiplies all the numbers a_i written on them.

Diana is happy when the product of the numbers ends with her favorite digit d. Now she is curious what cards she should pick so that the product of the numbers on them is the largest possible and the last decimal digit of the product is d. Please, help her.

Input

The first line contains the integers n and d (1≤ n≤ 10^5, 0≤ d≤ 9). The second line contains n integers a_i (1≤ a_i≤ 1000). 

Output

On the first line, print the number of chosen cards k (1≤ k≤ n). On the next line, print the numbers written on the chosen cards in any order. 

If it is impossible to choose a subset of cards with the product that ends with the digit d, print the single line with -1.

Examples

Input


6 4
4 11 8 2 1 13


Output


5
1 2 4 11 13 


Input


3 1
2 4 6


Output


-1


Input


5 7
1 3 1 5 3


Output


-1


Input


6 3
8 9 4 17 11 5


Output


3
9 11 17 


Input


5 6
2 2 2 2 2


Output


4
2 2 2 2 

Note

In the first example, 1 × 2 × 4 × 11 × 13 = 1144, which is the largest product that ends with the digit 4. The same set of cards without the number 1 is also a valid answer, as well as a set of 8, 11, and 13 with or without 1 that also has the product of 1144.

In the second example, all the numbers on the cards are even and their product cannot end with an odd digit 1.

In the third example, the only possible products are 1, 3, 5, 9, 15, and 45, none of which end with the digit 7.

In the fourth example, 9 × 11 × 17 = 1683, which ends with the digit 3. 

In the fifth example, 2 × 2 × 2 × 2 = 16, which ends with the digit 6.

Solution (in PYTHON3):

Solution:
import time

#start_time = time.time()
#def TIME_(): print(time.time()-start_time)

import os, sys
from io import BytesIO, IOBase
from types import GeneratorType
from bisect import bisect_left, bisect_right
from collections import defaultdict as dd, deque as dq, Counter as dc
import math, string, heapq as h
BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0
    def __init__(self, file):
        import os
        self.os = os
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
    def read(self):
        while True:
            b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
    def readline(self):
        while self.newlines == 0:
            b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
    def flush(self):
        if self.writable:
            self.os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
 
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

def getInt(): return int(input())
def getStrs(): return input().split()
def getInts(): return list(map(int,input().split()))
def getStr(): return input()
def listStr(): return list(input())
def getMat(n): return [getInts() for _ in range(n)]
def getBin(): return list(map(int,list(input())))
def isInt(s): return '0' <= s[0] <= '9'
def ceil_(a,b): return a//b + (a%b > 0)

MOD = 10**9 + 7

"""
1: {(1,1) (3,7) (9,9)}
2: {(1,2) (2,6) (3,4) (4,8) (6,7) (8,9)}
3: {(1,3) (7,9)}
4: {(1,4) (2,2) (2,7) (3,8) (4,6) (6,9) (8,8)}
5: {(1,5) (3,5) (5,5) (5,7) (5,9)}
6: {(1,6) (2,3) (2,8) (4,4) (4,9) (6,6) (7,8)}
7: {(1,7) (3,9)}
8: {(1,8) (2,4) (2,9) (3,6) (4,7) (6,8)}
9: {(1,9) (3,3) (7,7)}

Include all numbers ending in 1
Numbers ending in 3 go in cycles 3 -> 9 -> 7 -> 1

Let's pairwise multiply the 9s, fourwise multiply the 3s and 7s
We either include all 5s or no 5s


We definitely include:
    all 1s
    all but 3 to 6 of the 3s
    all but 3 to 6 of the 7s
    all but 1 to 2 of the 9s
    all the 5s or none of them

2 4 8 6
4 6 4 6
6 6 6 6
8 4 2 6

19 5
37 6 40 50 27 2 9 45 10 8 40 1 37 14 14 30 29 8 9
"""
from random import randint as ri

def solve():
    N, D = getInts()
    A = getInts()
    #N = ri(1,20)
    #D = ri(1,9)
    #A = [ri(1,50) for _ in range(N)]
    #print(N,D)
    #print(*A)
    dec = [[] for _ in range(10)]
    for a in A:
        dec[a%10].append(a)
    for i in range(10):
        dec[i].sort()
    if D == 0:
        if not dec[0] and not (dec[2] and dec[5]):
            print(-1)
            return
        else:
            print(N)
            print(*A)
            return
    else:
        dec[0] = []
    if D == 5:
        if not dec[5]:
            print(-1)
            return
        else:
            ans = []
            for a in A:
                if a % 2:
                    ans.append(a)
            print(len(ans))
            print(*ans)
            return
    else:
        dec[5] = []
    ans = []
    while dec[1]:
        ans.append(dec[1].pop())
    while len(dec[3]) > 6:
        for _ in range(4):
            ans.append(dec[3].pop())
    while len(dec[7]) > 6:
        for _ in range(4):
            ans.append(dec[7].pop())
    while len(dec[9]) > 2:
        for _ in range(2):
            ans.append(dec[9].pop())
    #print(ans)
    if D % 2:
        A = []
        for i in range(1,10,2):
            while dec[i]:
                A.append(dec[i].pop())
        best = -1
        best_mask = -1
        for x in range(1,pow(2,len(A))):
            mask = bin(x)[2:].zfill(len(A))
            tmp = 1
            for j in range(len(A)):
                if mask[j] == '1':
                    tmp *= A[j]
            if tmp % 10 == D and tmp > best:
                best = tmp
                best_mask = mask
        if best != -1:
            for j in range(len(A)):
                if best_mask[j] == '1':
                    ans.append(A[j])
            print(len(ans))
            print(*ans)
            return
        elif (D == 1) and ans:
            print(len(ans))
            print(*ans)
            return
        else:
            print(-1)
            return
    while dec[6]:
        ans.append(dec[6].pop())
    while len(dec[2]) > 6:
        for _ in range(4):
            ans.append(dec[2].pop())
    while len(dec[8]) > 6:
        for _ in range(4):
            ans.append(dec[8].pop())
    while len(dec[4]) > 2:
        for _ in range(2):
            ans.append(dec[4].pop())
    #now I need the best mask for digit
    A_odd = []
    A_even = []
    for i in range(0,10,2):
        while dec[i]:
            A_even.append(dec[i].pop())
        while dec[i+1]:
            A_odd.append(dec[i+1].pop())
    best = [-1]*10
    best_mask = [-1]*10
    if ans:
        best[1] = 1
        best_mask[1] = 0
    for x in range(1,pow(2,len(A_odd))):
        mask = bin(x)[2:].zfill(len(A_odd))
        tmp = 1
        for j in range(len(A_odd)):
            if mask[j] == '1':
                tmp *= A_odd[j]
        if tmp > best[tmp%10]:
            best[tmp%10] = tmp
            best_mask[tmp%10] = x
    for x in range(1,pow(2,len(A_even))):
        mask = bin(x)[2:].zfill(len(A_even))
        tmp = 1
        for j in range(len(A_even)):
            if mask[j] == '1':
                tmp *= A_even[j]
        if tmp > best[tmp%10]:
            best[tmp%10] = tmp
            best_mask[tmp%10] = x
    best_combo = -1
    best_pair = [-1,-1]
    for i in range(0,10,2):
        for j in range(1,10,2):
            if best[i] != -1 and best[j] != -1:
                curr = best[i]*best[j]
                if curr % 10 == D and curr > best_combo:
                    best_combo = curr
                    best_pair = [i,j]
    if best[D] > best_combo:
        x = best_mask[D]
        mask = bin(x)[2:].zfill(len(A_even))
        for j in range(len(A_even)):
            if mask[j] == '1':
                ans.append(A_even[j])
        print(len(ans))
        print(*ans)
        return
    #print(best_combo,best_pair)
    #print(A_even,A_odd)
    #print(best_mask[2],best_mask[9])
    if best_pair == [-1,-1]:
        print(-1)
        return
    k,i = best_pair
    x = best_mask[i]
    mask = bin(x)[2:].zfill(len(A_odd))
    for j in range(len(A_odd)):
        if mask[j] == '1':
            ans.append(A_odd[j])
    x = best_mask[k]
    mask = bin(x)[2:].zfill(len(A_even))
    for j in range(len(A_even)):
        if mask[j] == '1':
            ans.append(A_even[j])
    print(len(ans))
    print(*ans)
    return

#for _ in range(getInt()):
#print(solve())
solve()

#TIME_()