#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
ll N, M, mx=0, argmx=1;
cin >> N >> M;
vector<ll> cnt(M+1), A(N);
vector<ll> v(M+1);
for (int i=0; i<N; i++){
cin >> A[i];
if(A[i]>M) continue;
v[A[i]]++;
}
for (int x=1; x<=M; x++){
for (int i=x; i<=M; i+=x){
cnt[i] += v[x];
}
}
for (int i=1; i<=M; i++){
if (cnt[i] > mx){
mx = cnt[i];
argmx = i;
}
}
vector<int> ans;
for (int i=0; i<N; i++) if (argmx % A[i] == 0) ans.push_back(i+1);
assert(mx == (ll)ans.size());
cout << argmx << " " << mx << endl;
for (auto x : ans) cout << x << " ";
cout << endl;
return 0;
}
99A - Help Far Away Kingdom | 622B - The Time |
1688C - Manipulating History | 1169D - Good Triple |
1675B - Make It Increasing | 588A - Duff and Meat |
1541B - Pleasant Pairs | 1626B - Minor Reduction |
1680A - Minimums and Maximums | 1713A - Traveling Salesman Problem |
1713B - Optimal Reduction | 1710A - Color the Picture |
1686B - Odd Subarrays | 251A - Points on Line |
427C - Checkposts | 1159A - A pile of stones |
508A - Pasha and Pixels | 912A - Tricky Alchemy |
1249A - Yet Another Dividing into Teams | 1713C - Build Permutation |
1699A - The Third Three Number Problem | 1617B - GCD Problem |
841A - Generous Kefa | 1690B - Array Decrements |
1692C - Where's the Bishop | 104A - Blackjack |
1438A - Specific Tastes of Andre | 1711C - Color the Picture |
1194C - From S To T | 110B - Lucky String |