func_code_string: #include <bits/stdc++.h>   using namespace std;   int mp[1000007];   int dp[1010][10010];   int pre[1010][10010];   long long ans[1010][10010];   int out[1010][10010];   long long a[1010];   long long v[10010];   int cnt;   int add(long long k) {     if (!mp[k % 1000007]) {       v[++cnt] = k;       mp[k % 1000007] = cnt;     }     return mp[k % 1000007];   }   long long gcd(long long x, long long y) {     if (x % y == 0)       return y;     else       return gcd(y, x % y);   }   void output(int x, int y) {     printf( %d  , out[y][x]);     if (pre[y][x] == 1) return;     output(pre[y][x], out[y][x] - 1);   }   int main() {     int n;     long long k;     scanf( %d%lld , &n, &k);     for (int i = 1; i <= n; i++) {       scanf( %lld , &a[i]);     }     if (k == 1) {       long long p = a[1];       int x = 1;       for (int i = 1; i <= n; i++) {         if (p > a[i]) {           p = a[i];           x = i;         }       }       printf( %d n%d n , 1, x);       return 0;     }     memset(dp, -1, sizeof(dp));     add(k);     dp[0][1] = 0;     for (int i = 1; i <= n; i++) {       int cnt1 = cnt;       for (int k = 1; k <= cnt1; k++) {         dp[i][k] = dp[i - 1][k];         ans[i][k] = ans[i - 1][k];         pre[i][k] = pre[i - 1][k];         out[i][k] = out[i - 1][k];       }       for (int k = 1; k <= cnt1; k++) {         long long g = gcd(a[i], v[k]);         int x = add(v[k] / g);         if (dp[i][x] == -1 || dp[i][x] > dp[i - 1][k] + 1) {           dp[i][x] = dp[i - 1][k] + 1;           pre[i][x] = k;           ans[i][x] = ans[i - 1][k] + a[i];           out[i][x] = i;         } else if (dp[i][x] == dp[i - 1][k] + 1 &&                    ans[i][x] > ans[i - 1][k] + a[i]) {           pre[i][x] = k;           ans[i][x] = ans[i - 1][k] + a[i];           out[i][x] = i;         }       }     }     if (mp[1] == 0) {       printf( -1 n );     } else {       printf( %d n , dp[n][mp[1]]);       output(mp[1], n);     }     return 0;   }   