#include<iostream>
#include<climits>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<queue>
#include<string>
#include<vector>
#include<tuple>
#include<set>
#include<bitset>
#include<unordered_map>
using namespace std;
using ll = long long;
using ull = unsigned long long;
const int N = 310, mod = 1000000007, INF = 0x3f3f3f3f, M = 1010, P = 13331, K = M / 2;
const double eps = 1e-8;
#define x first
#define y second
typedef pair<int, int> PII;
int T, n, m, k, len, res, e[M], ne[M], h[N], w[M], idx, dist[N], a[N], v[N], f[N][N], path[N];
bool st[M], flag;
int months[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
//int dx[9] = {-1, -1, -1, 0, 0, 1, 1, 1, 0}, dy[9] = {-1, 0, 1, -1, 1, -1, 0, 1, 0};
int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, 1, 0, -1};
//priority_queue<PII, vector<PII>, greater<PII>> q[N];
vector<int> state;
int cnt[M];
vector<int> head[M];
//char g[N][N];
//char s[N], tmp[N];
struct Good {
int v, w;
};
struct nodes {
int t, d, l;
bool operator< (const nodes& V) const {
return t + d < V.t + V.d;
}
} node[N];
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
void add(int a, int b, int c) {
e[idx] = b, w[idx] = c, ne[idx] = h[a], h[a] = idx++;
}
//void dfs1(int u) {
// f[u][0] = 0, f[u][1] = 1;
// for (int i = h[u]; ~i; i = ne[i]) {
// int j = e[i];
// dfs1(j);
// f[u][1] += min(f[j][1], f[j][0]);
// f[u][0] += f[j][1];
// }
//}
//void bfs(PII start) {
// queue<PII> q;
// q.push(start);
// g[start.x][start.y] = -1;
//
// while (q.size()) {
// auto t = q.front();
// q.pop();
//
//
//
//
//
// }
//}
void dfs(int i, int j) {
if (!i) return;
if (j >= v[i] && f[i][j] == f[i - 1][j - v[i]] + w[i]) {
path[idx++] = i;
dfs(i - 1, j - v[i]);
return;
}
dfs(i - 1, j);
return;
}
int main()
{
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
cin >> n >> m;
for (int i = 1; i <= n; ++i) cin >> v[i] >> w[i];
for (int i = 1; i <= n; ++i) {
for (int j = 0; j <= m; ++j) {
f[i][j] = f[i - 1][j];
if (j >= v[i]) f[i][j] = max(f[i][j], f[i - 1][j - v[i]] + w[i]);
}
}
dfs(n, m);
for (int i = idx - 1; i >= 0; --i) cout << path[i] << " ";
return 0;
}
