#include<bits/stdc++.h>
using namespace std;

template<typename X, typename Y>
bool chmax(X& a, Y b) { return (a < b) ? a = b, 1 : 0; }

template<typename X, typename Y>
bool chmin(X& a, Y b) { return (a > b) ? a = b, 1 : 0; }

using ll = long long;
using ull = unsigned long long;

const int N = 5e3+5;

int n, P, a[N];
ull dp[N];
// unsigned long long: [0, 2^64], > 2^64 tu mod voi 2^64

void solve() {
    cin >> n >> P;
    for (int i = 1; i <= n; i++) cin >> a[i];
    dp[0] = 1;
    for (int i = 1; i <= n; i++)
        if (a[i] < P)
            for (int j = P; j >= a[i]; j--)
                dp[j] += dp[j - a[i]];
    vector<int> ans;
    for (int i = 1; i <= n; i++) {
        if (a[i] >= P) {
            ans.push_back(i);
            continue;
        }
        for (int j = a[i]; j <= P; j++) dp[j] -= dp[j - a[i]]; 
        bool f = false;
        for (int j = max(0, P - a[i]); j < P; j++)
            if (dp[j] > 0) {
                f = true;
                break;
            }
        if (f) ans.push_back(i);
        for (int j = P; j >= a[i]; j--) dp[j] += dp[j - a[i]];
    }
    for (int x : ans) cout << x << ' ';
    cout << '\n';
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);

    #define TASK "BAI2"
    if (fopen(TASK".INP", "r")) {
        freopen(TASK".INP", "r", stdin);
        freopen(TASK".OUT", "w", stdout);
    }

    int tests = 1; // cin >> tests;
    while (tests--) solve();

    #ifdef LOCAL
    cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    #endif
    return 0;
}