#include <bits/stdc++.h>
using namespace std;
struct DP {
  int cnt;
  long long sum;
  vector<int> elements;
} dp[7111];
long long gcd(long long a, long long b) {
  while (a && b)
    if (a > b)
      a %= b;
    else
      b %= a;
  return a + b;
}
long long a[1111];
vector<long long> divisors;
unordered_map<long long, int> numDivisors;
int main() {
  int n;
  long long k;
  scanf("%d%I64d", &n, &k);
  int p = 1;
  for (int i = 1; i <= n; i++) {
    scanf("%I64d", &a[i]);
    if (a[p] > a[i]) p = i;
  }
  if (k == 1) {
    printf("%d\n%d\n", 1, p);
    return 0;
  }
  for (long long i = 1; i <= sqrt(k); i++) {
    if (k % i == 0) {
      divisors.push_back(i);
      if (k / i != i) divisors.push_back(k / i);
    }
  }
  sort(divisors.begin(), divisors.end());
  int cntDivisors = divisors.size();
  for (int i = 0; i < cntDivisors; i++) numDivisors[divisors[i]] = i;
  for (int i = 0; i <= cntDivisors; i++) dp[i].cnt = 1e9;
  dp[0].cnt = 0;
  dp[0].sum = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = cntDivisors - 1; j >= 0; j--) {
      int x = numDivisors[divisors[j] / gcd(a[i], divisors[j])];
      if (dp[j].cnt > dp[x].cnt + 1 ||
          (dp[j].cnt == dp[x].cnt + 1 && dp[j].sum > dp[x].sum + a[i])) {
        dp[j] = dp[x];
        dp[j].cnt++;
        dp[j].sum += a[i];
        dp[j].elements.push_back(i);
      }
    }
  }
  if (dp[numDivisors[k]].cnt == 1e9)
    cout << -1 << endl;
  else {
    printf("%d\n", dp[numDivisors[k]].elements.size());
    for (int i = 0; i < dp[numDivisors[k]].elements.size(); i++)
      printf("%d ", dp[numDivisors[k]].elements[i]);
    printf("\n");
  }
}
