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 CPP):

Solution:
#pragma GCC optimize("O3", "unroll-loops")
#pragma GCC target("sse4.2")

#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <bitset>
#include <sstream>
#include <deque>
#include <queue>
#include <complex>
#include <random>
#include <cassert>
#include <chrono>
#include <functional>

using namespace std;

#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define FIXED cout << fixed << setprecision(12)
#define ll long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define graph vector<vector<int>>
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define f first
#define s second
#define hashmap unordered_map
#define hashset unordered_set
#define eps 1e-9
#define mod 1000000007
#define inf 3000000000000000007ll
#define sz(a) signed((a).size())
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

#ifdef DEBUG
    mt19937 gen(857204);
#else
    mt19937 gen(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif

void flush() { cout << flush; }
void flushln() { cout << endl; }
void println() { cout << '\n'; }
template<class T> void print(const T &x) { cout << x; }
template<class T> void read(T &x) { cin >> x; }
template<class T, class ...U> void read(T &x, U& ... u) { read(x); read(u...); }
template<class T, class ...U> void print(const T &x, const U& ... u) { print(x); print(u...); }
template<class T, class ...U> void println(const T &x, const U& ... u) { print(x); println(u...); }

#ifdef DEBUG
    template<class T> string pdbg(const T &x) { stringstream ss; ss << x; return ss.str(); }
    template<class T, class U> string pdbg(const pair<T, U> &p) { return "{" + pdbg(p.f) + "," + pdbg(p.s) + "}"; }
    string pdbg(const string &s) { return "\"" + s + "\""; }
    template<class It> string pdbg(It begin, It end, string d);
    template<class T> string pdbg(const vector<T> &a) { return pdbg(all(a), ""); }
    template<class T> string pdbg(const vector<vector<T>> &a) { return pdbg(all(a), "\n"); }
    template<class T> string pdbg(const vector<vector<vector<T>>> &a) { return pdbg(all(a), "\n\n"); }
    template<class T> string pdbg(const set<T> &a) { return pdbg(all(a), ""); }
    template<class T> string pdbg(const hashset<T> &a) { return pdbg(all(a), ""); }
    template<class T, class U> string pdbg(const map<T, U> &a) { return pdbg(all(a), ""); }
    template<class T, class U> string pdbg(const hashmap<T, U> &a) { return pdbg(all(a), ""); }
    template<class It> string pdbg(It begin, It end, string d) {
        string ans;
        ans += "{";
        if (begin != end) ans += pdbg(*begin++);
        while (begin != end)
            ans += "," + d + pdbg(*begin++);
        ans += "}";
        return ans;
    }
    template<class T> string dbgout(const T &x) { return pdbg(x); }
    template<class T, class... U>
    string dbgout(T const &t, const U &... u) {
        string ans = pdbg(t);
        ans += ", ";
        ans += dbgout(u...);
        return ans;
    }
    #define dbg(...) print("[", #__VA_ARGS__, "] = ", dbgout(__VA_ARGS__)), flushln()
    #define msg(...) print("[", __VA_ARGS__, "]"), flushln()
#else
    #define dbg(...) 0
    #define msg(...) 0
#endif

template<class T, class U> inline bool chmin(T &x, const U& y) { return y < x ? x = y, 1 : 0; }
template<class T, class U> inline bool chmax(T &x, const U& y) { return y > x ? x = y, 1 : 0; }
template<class T> inline void sort(T &a) { sort(all(a)); }
template<class T> inline void rsort(T &a) { sort(rall(a)); }
template<class T> inline void reverse(T &a) { reverse(all(a)); }
template<class T, class U> inline istream& operator>>(istream& str, pair<T, U> &p) { return str >> p.f >> p.s; }
template<class T> inline istream& operator>>(istream& str, vector<T> &a) { for (auto &i : a) str >> i; return str; }
template<class T> inline T sorted(T a) { sort(a); return a; }

vector<vector<int>> bydig(10);

pair<ld, vector<int>> ans = {-1, {}};
vector<int> deleted;
int n, d;

int mpow(int d, int n) {
    int ans = 1;
    while (n > 0) {
        if (n & 1) ans = (ans * d) % 10;
        d = (d * d) % 10;
        n >>= 1;
    }
    return ans;
}

void rec(int i, ld sum, int currd) {
    currd %= 10;
    if (i == sz(bydig)) {
        if (currd == d && sz(deleted) < n) {
            dbg(deleted, currd);
            dbg(sum);
            chmax(ans, make_pair(sum, deleted));
        }
        return;
    }
    rec(i + 1, sum, currd * mpow(i, sz(bydig[i])));
    for (int cnt = 1; cnt < 4 && cnt <= sz(bydig[i]); ++cnt) {
        deleted.pb(bydig[i][cnt - 1]);
        sum -= log2(deleted.back());
        rec(i + 1, sum, currd * mpow(i, sz(bydig[i]) - cnt));
    }
    for (int cnt = 1; cnt < 4 && cnt <= sz(bydig[i]); ++cnt) {
        deleted.popb();
    }
}

signed main() {
    FAST; FIXED;
    read(n, d);
    multiset<int> st;
    for (int i = 0; i < n; ++i) {
        int a;
        read(a);
        bydig[a % 10].pb(a);
        st.insert(a);
    }
    if (d % 5 != 0) {
        for (auto i : bydig[0]) st.erase(st.find(i));
        bydig[0].clear();
        for (auto i : bydig[5]) st.erase(st.find(i));
        bydig[5].clear();
    }
    if (d % 2 != 0) {
        for (auto i : bydig[0]) st.erase(st.find(i));
        bydig[0].clear();
        for (auto i : bydig[2]) st.erase(st.find(i));
        bydig[2].clear();
        for (auto i : bydig[4]) st.erase(st.find(i));
        bydig[4].clear();
        for (auto i : bydig[6]) st.erase(st.find(i));
        bydig[6].clear();
        for (auto i : bydig[8]) st.erase(st.find(i));
        bydig[8].clear();
    }
    n = 0;
    for (auto i : bydig) n += sz(i);
    for (auto &i : bydig) sort(i);
    ld sum = 0;
    for (auto i : bydig)
        for (auto j : i)
            sum += log2(j);
    rec(0, sum, 1);
    if (ans.f < 0) {
        println(-1);
        return 0;
    }
    for (auto i : ans.s) st.erase(st.find(i));
    if (sz(st) == 0) {
        println(-1);
        return 0;
    }
    println(sz(st));
    for (auto i : st) print(i, ' ');
    // ll prod = 1;
    // for (auto i : st) prod *= i;
    // println(prod);
    #ifdef DEBUG
        cerr << "Runtime is: " << clock() * 1.0 / CLOCKS_PER_SEC << endl;
    #endif
    return 0;
}