#include <bits/stdc++.h>
using namespace std;
struct aa {
  int a, b;
} arr[200010];
bool fff(struct aa a, struct aa b) {
  if (a.a == b.a) {
    return a.b > b.b;
  }
  return a.a < b.a;
}
int crr[200010];
map<int, int> mp[10010];
int main() {
  priority_queue<int> qumax;
  priority_queue<int, vector<int>, greater<int>> qumin;
  int t, n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &arr[i].a, &arr[i].b);
    ;
    mp[arr[i].b][i] = arr[i].a;
  }
  sort(arr + 1, arr + n + 1, fff);
  int count = 0;
  int sum = 0;
  for (int i = n; i > 0; i--) {
    if (count > arr[i].a) {
      break;
    }
    qumin.push(arr[i].b);
    if (!qumax.empty() && !qumin.empty() && (qumax.top() > qumin.top())) {
      sum += qumin.top();
      qumax.push(qumin.top());
      qumin.pop();
      sum -= qumax.top();
      qumin.push(qumax.top());
      qumax.pop();
    }
    while (!qumin.empty() && sum + qumin.top() <= m) {
      sum += qumin.top();
      qumax.push(qumin.top());
      qumin.pop();
      count++;
    }
    if (count >= arr[i].a) {
      count = min(arr[i].a, count);
      break;
    }
  }
  cout << count << endl;
  cout << count << endl;
  for (int i = 0; i < count; i++) {
    int a = qumax.top();
    qumax.pop();
    map<int, int>::iterator it = mp[a].begin();
    for (it; it != mp[a].end(); it++) {
      if (it->second >= count) {
        crr[i] = it->first;
        mp[a].erase(it);
        break;
      }
    }
  }
  for (int i = 0; i < count; i++) {
    if (i != 0) {
      cout << ' ';
    }
    cout << crr[i];
  }
}
