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

Solution:
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.Scanner;

public class Main {
  private static final int V = 1000;
  private static final int D = 10;
  private static ArrayList<ArrayList<Integer>> powers;

  private static void init() {
    powers = new ArrayList<ArrayList<Integer>>();
    for (int d = 0; d < D; ++d) {
      powers.add(new ArrayList<>());
      powers.get(d).add(1);
      HashSet<Integer> used = new HashSet<Integer>();
      int curr = 1;
      while (true) {
        curr = (curr * d) % 10;
        if (used.contains(curr)) {
          break;
        }
        powers.get(d).add(curr);
        used.add(d);
      }
    }
  }

  private static int[] best;
  private static ArrayList<ArrayList<Double>> lg;

  private static int[] build(ArrayList<ArrayList<Integer>> gp, int[] s) {
    int[] ret = new int[D];
    for (int d = 0; d < D; ++d) {
      if (s[d] == 0) {
        ret[d] = 0;
      } else {
        int L = powers.get(d).size() - 1;
        int N = gp.get(d).size();
        ret[d] = (N - s[d]) / L * L + s[d];
      }
    }
    return ret;
  }

  private static void compare(ArrayList<ArrayList<Integer>> gp, int[] s) {
    if (best == null) {
      best = Arrays.copyOf(s, s.length);
      return;
    }
    int[] prev = build(gp, best);
    int[] curr = build(gp, s);
    double xv = 0, yv = 0;
    for (int d = 0; d < D; ++d) {
      if (prev[d] > curr[d]) {
        xv += lg.get(d).get(prev[d]) - lg.get(d).get(curr[d]);
      } else if (curr[d] > prev[d]) {
        yv += lg.get(d).get(curr[d]) - lg.get(d).get(prev[d]);
      }
    }
    if (xv < yv) {
      best = Arrays.copyOf(s, s.length);
    }
  }

  private static boolean dfs(int m, ArrayList<ArrayList<Integer>> gp, int rem, int pos, int[] s) {
    if (pos == D) {
      if (rem == m) {
        compare(gp, s);
        return true;
      } else {
        return false;
      }
    }
    boolean ret = false;
    int N = powers.get(pos).size() - 1;
    s[pos] = 0;
    if (dfs(m, gp, rem, pos + 1, s)) {
      ret = true;
    }
    for (int i = 1; i <= N && i <= gp.get(pos).size(); ++i) {
      s[pos] = i;
      if (dfs(m, gp, (rem * powers.get(pos).get(i)) % 10, pos + 1, s)) {
        ret = true;
      }
    }
    return ret;
  }

  private static void solve(int n, int m, int[] a) {
    ArrayList<ArrayList<Integer>> gp = new ArrayList<ArrayList<Integer>>();
    for (int d = 0; d < D; ++d) {
      gp.add(new ArrayList<Integer>());
    }
    for (int x : a) {
      gp.get(x % D).add(x);
    }
    for (ArrayList<Integer> x : gp) {
      Collections.sort(x);
      Collections.reverse(x);
    }
    lg = new ArrayList<ArrayList<Double>>();
    for (int d = 0; d < D; ++d) {
      lg.add(new ArrayList<Double>());
      lg.get(d).add(0.0);
      for (int i = 1; i <= gp.get(d).size(); ++i) {
        lg.get(d).add(lg.get(d).get(i - 1) + Math.log(gp.get(d).get(i - 1)));
      }
    }
    best = null;
    int[] s = new int[D];
    boolean res = dfs(m, gp, 1, 0, s);
    if (!res) {
      System.out.println(-1);
      return;
    }
    best = build(gp, best);
    int num = 0;
    for (int x : best) {
      num += x;
    }
    if (num == 0) {
      System.out.println(-1);
      return;
    }
    System.out.println(num);
    ArrayList<Integer> ans = new ArrayList<Integer>();
    for (int d = 0; d < D; ++d) {
      for (int i = 0; i < best[d]; ++i) {
        ans.add(gp.get(d).get(i));
      }
    }
    for (Integer x : ans) {
      System.out.print(x);
      System.out.print(" ");
    }
    System.out.println();
  }

  public static void main(String[] args) {
    init();
    Scanner cin = new Scanner(System.in);
    int n, m;
    while (cin.hasNextInt()) {
      n = cin.nextInt();
      m = cin.nextInt();
      int[] a = new int[n];
      for (int i = 0; i < n; ++i) {
        a[i] = cin.nextInt();
      }
      solve(n, m, a);
    }
    cin.close();
  }
}