#include <bits/stdc++.h>
using namespace std;
int n, m;
long long K;
long long a[1010];
vector<int> S, L;
int small[1010101], large[1010101];
vector<long long> ds;
template <class T1, class T2>
bool chmin(T1 &a, T2 b) {
  if (b < a) {
    a = b;
    return true;
  }
  return false;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int vtoi(long long v) {
  if (v <= S.back()) {
    return small[v];
  } else {
    return large[K / v];
  }
}
int main() {
  cin >> n >> K;
  for (int i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
  }
  if (K == 1) {
    int i = min_element(a, a + n) - a;
    cout << 1 << endl;
    cout << i + 1 << endl;
    return 0;
  }
  for (long long i = 1; i * i <= K; i++) {
    if (K % i == 0) {
      S.push_back(i);
      ds.push_back(i);
      if (K / i != i) {
        L.push_back(i);
        ds.push_back(K / i);
      }
    }
  }
  reverse(L.begin(), L.end());
  sort(ds.begin(), ds.end());
  m = ds.size();
  int k = 0;
  for (int x : S) small[x] = k++;
  for (int x : L) large[x] = k++;
  static pair<pair<int, long long>, pair<int, int>> dp[1010][7000];
  fill_n(*dp, 1010 * 7000, make_pair(make_pair(1e8, 1e17), make_pair(-1, -1)));
  dp[0][0] = make_pair(make_pair(0, 0), make_pair(-1, -1));
  for (int i = 0; i < n; i++) {
    long long A = gcd(a[i], K);
    for (int j = 0; j < m; j++)
      if (dp[i][j].first.first < n) {
        int nj = vtoi(A * gcd(ds[j], K / A));
        chmin(dp[i + 1][j], dp[i][j]);
        chmin(dp[i + 1][nj], make_pair(make_pair(dp[i][j].first.first + 1,
                                                 dp[i][j].first.second + a[i]),
                                       make_pair(i, j)));
      }
  }
  if (dp[n][m - 1].second.first == -1) {
    cout << -1 << endl;
    return 0;
  }
  vector<int> ans;
  pair<int, int> p = dp[n][m - 1].second;
  while (p.first != -1) {
    ans.push_back(p.first);
    p = dp[p.first][p.second].second;
  }
  cout << ans.size() << endl;
  for (int x : ans) cout << x + 1 << " ";
  cout << endl;
}
