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 collections
import string
import math
import copy
import os
import sys
from io import BytesIO, IOBase

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        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 = os.read(self._fd, max(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 = os.read(self._fd, max(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:
            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)


def input(): return sys.stdin.readline().rstrip("\r\n")


# n = 0
# m = 0

# n = int(input())

# li = [int(i) for i in input().split()]

# s = sorted(li)
"""
from dataclasses import dataclass

@dataclass
class point:
    x: float
    y: float
 
 
@dataclass
class line:
    A: float
    B: float
    C: float
 
    def gety(self, x):
        return (self.A*x+self.C)/-self.B
    
    def getx(self, y):
        return (self.B*y+self.C)/-self.A
 
    def k(self):
        return -self.A/self.B
 
    def b(self):
        return -self.C/self.B
 
    def dist(self, p: point):
        return abs((self.A*p.x+self.B*p.y+self.C)/(self.A**2+self.B**2)**0.5)
 
 
def calc_line(u: point, v: point):
    return line(A=u.y-v.y, B=v.x-u.x, C=u.y*(u.x-v.x)-u.x*(u.y-v.y))
 
 
def is_parallel(u: line, v: line) -> bool:
    f1 = False
    f2 = False
    try:
        k1 = u.k()
    except:
        f1 = True
    try:
        k2 = v.k()
    except:
        f2 = True
    if f1 != f2:
        return False
    return f1 or k1 == k2
 
 
def seg_len(_from: point, _to: point):
    return ((_from.x - _to.x)**2 + (_from.y - _to.y)**2) ** 0.5
 
def in_range(_from: point, _to: point, _point: point) -> bool:
    if _from.x < _to.x:
        if _from.y < _to.y:
            return _from.x <= _point.x <= _to.x and _from.y <= _point.y <= _to.y
        else:
            return _from.x <= _point.x <= _to.x and _from.y >= _point.y >= _to.y
    else:
        if _from.y < _to.y:
            return _from.x >= _point.x >= _to.x and _from.y <= _point.y <= _to.y
        else:
            return _from.x >= _point.x >= _to.x and _from.y >= _point.y >= _to.y
 
def intersect(u: line, v: line) -> point:
    tx = (u.B*v.C-v.B*u.C)/(v.B*u.A-u.B*v.A)
    if u.B!=0.0:
        ty = -u.A*tx/u.B - u.C/u.B
    else:
        ty = -v.A*tx/v.B - v.C/v.B
    return point(x=tx, y=ty)
 
def in_direction(_from: point, _to: point, _point: point) -> bool:
    if _from.x < _to.x:
        if _from.y < _to.y:
            return _to.x < _point.x  and _to.y < _point.y
        else:
            return _to.x < _point.x  and _point.y <= _to.y
    else:
        if _from.y < _to.y:
            return _to.x >= _point.x  and _to.y < _point.y
        else:
            return _to.x >= _point.x  and _point.y <= _to.y


"""
mo = int(1e9+7)


def exgcd(a, b):
    if not b:
        return 1, 0
    y, x = exgcd(b, a % b)
    y -= a//b * x
    return x, y


def getinv(a, m):
    x, y = exgcd(a, m)
    return -1 if x == 1 else x % m


def comb(n, b):
    res = 1
    b = min(b, n-b)
    for i in range(b):
        res = res*(n-i)*getinv(i+1, mo) % mo
        # res %= mo
    return res % mo


def quickpower(a, n):
    res = 1
    while n:
        if n & 1:
            res = res * a % mo
        n >>= 1
        a = a*a % mo
    return res


def dis(a, b):
    return abs(a[0]-b[0]) + abs(a[1]-b[1])


def getpref(x):
    if x > 1:
        return (x)*(x-1) >> 1
    else:
        return 0


def orafli(upp):
    primes = []
    marked = [False for i in range(upp+3)]
    prvs = [i for i in range(upp+3)]
    for i in range(2, upp):
        if not marked[i]:
            primes.append(i)
        for j in primes:
            if i*j >= upp:
                break
            marked[i*j] = True
            prvs[i*j] = j
            if i % j == 0:
                break
    return primes, prvs


def lower_ord(c: str) -> int:
    return ord(c)-97


def upper_ord(c: str) -> int:
    return ord(c) - 65


def read_list():
    return [int(i) for i in input().split()]


def read_int():
    s = input().split()
    if len(s) == 1:
        return int(s[0])
    else:
        return map(int, s)


def ask(s):
    print(f"? {s}", flush=True)


def answer(s):
    print(f"{s}", flush=True)

import random
def solve():
    n, d = read_int()
    l = read_list()
    # dp = [[0 for i in range(10)] for i in range(n)]
    dp  = {}
    pv = []
    for i in l:
        cd = copy.deepcopy(dp)
        cp = {}
        for k, v in dp.items():
            lg = math.log(i,2)
            if v+lg >cd.get(k*i%10,0):
                # prvcd = cd[k*i%10]
                cp[v+lg] = v
                cd[k*i%10] = v+lg
            # cd[k*i%10] = max(cd.get(k*i%10, 1), v+math.log(i,2))
        lg = math.log(i,2)
        if lg > cd.get(i%10, 0):
            cp[lg]=0
            cd[i%10] = lg
        pv.append(cp)
            # cd[i%10] = max(cd.get(i%10, 1), math.log(i,2))

        dp = cd
    sel = []
    if d not in dp:
        print(-1)
    else:
        # print(dp[d])
        # c = int(round(2**dp[d]))
        # print(pv)
        c = dp[d]
        # rc = round(c,14)
        while pv:
            fac = pv.pop()
            curfac = l.pop()
            if c in fac:
                sel.append(curfac)
                c = fac[c]


        # for i in l:
        #     if c%i==0:
        #         sel.append(i)
        #         c//=i
        print(len(sel))
        print(*sel)
    # print(dp.get(d, -1))





    

    
# fi = open('C:\\cppHeaders\\CF2020.12.17\\test.data', 'r')
# def input(): return fi.readline().rstrip("\r\n")
# primes, prv = orafli(10001)
solve()
# t = int(input())

# for ti in range(t):
    # print(f"Case #{ti+1}: ", end='')
    # solve()