#include #include #include #include using namespace std; int main() { int N, S; cin >> N >> S; vector P(N); for (int i = 0; i < N; ++i) { cin >> P[i]; } // Pair of (value, original index) vector> Parg(N); for (int i = 0; i < N; ++i) { Parg[i] = {P[i], i}; } // Sort based on the values sort(Parg.begin(), Parg.end()); vector out; if (N == 1) { cout << 1 << endl; cout << 1 << endl; return 0; } if (Parg[1].first - Parg[0].first > S) { out.push_back(Parg[0].second); } if (Parg[N-1].first - Parg[N-2].first > S) { out.push_back(Parg[N-1].second); } for (int i = 1; i < N - 1; ++i) { if (Parg[i].first - Parg[i-1].first > S && Parg[i+1].first - Parg[i].first > S) { out.push_back(Parg[i].second); } } cout << out.size() << endl; sort(out.begin(), out.end()); for (const int& index : out) { cout << index + 1 << " "; } cout << endl; return 0; }