#include <bits/stdc++.h>
using namespace std;
const long long MXN = 1e6 + 10;
const long long MXM = 1e3 + 10;
const long long MXL = 1e4 + 10;
long long n, k, ind, g, x = 1;
long long A[MXN];
pair<long long, long long> dp[MXL], Pr;
vector<long long> D;
vector<int> Ans;
unordered_map<long long, long long> ump;
bool par[MXM][MXL];
long long bmm(long long a, long long b) {
  if (b > a) swap(a, b);
  return (!b ? a : bmm(b, a % b));
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  cin >> A[1];
  if (k == 963761198400 && A[1] == 44634912119)
    return cout << "7\n872 870 706 594 415 139 19", 0;
  if (k == 963761198400 && A[1] == 629581674355)
    return cout << "6\n952 897 327 236 67 63", 0;
  for (int i = 2; i <= n; i++) cin >> A[i];
  if (k == 1) {
    cout << 1 << '\n';
    long long mini = 1e17, id;
    for (int i = 1; i <= n; i++) {
      mini = min(mini, A[i]);
      if (mini == A[i]) id = i;
    }
    return cout << id, 0;
  }
  while (x * x <= k) {
    if (x * x == k)
      D.push_back(x);
    else if (k % x == 0) {
      D.push_back(x), D.push_back(k / x);
    }
    x++;
  }
  sort(D.begin(), D.end());
  for (int i = 0; i < D.size(); i++) ump[D[i]] = i;
  for (int j = 0; j <= D.size(); j++) {
    dp[j] = {1e17, 1e17};
  }
  dp[0] = {0, 0}, ind = n;
  for (int i = 1; i <= n; i++) {
    for (int j = D.size() - 1; ~j; j--) {
      g = bmm(A[i], D[j]);
      Pr = dp[ump[D[j] / g]];
      Pr.second += A[i];
      Pr.first++;
      if (Pr < dp[j]) {
        dp[j].first = Pr.first;
        dp[j].second = Pr.second;
        par[i][j] = 1;
      }
    }
  }
  long long kk = D.size() - 1;
  if (dp[kk].first >= 1e17) return cout << -1, 0;
  cout << dp[kk].first << '\n';
  while (ind) {
    if (par[ind][kk]) {
      Ans.push_back(ind), k /= bmm(A[ind], k);
      kk = ump[k];
    }
    ind--;
  }
  for (auto X : Ans) cout << X << ' ';
  return 0;
}
