#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cfenv>
#include <cfloat>
#include <chrono>
#include <cinttypes>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdarg>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <immintrin.h>
#include <initializer_list>
#include <iomanip>
#include <ios>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <streambuf>
#include <string>
#include <tuple>
#include <type_traits>
#include <variant>
using namespace std;
//numbers
using ll=long long;
#define int ll
using ld=long double;
//pairs
#define P pair
#define pi P<int,int>
#define ff first
#define ss second
#define mp make_pair
//std data structure
#define all(x) begin(x), end(x)
#define sz(x) (int) (x).size()
//vectors
#define V vector
#define vi V<int>
#define v2i V<vi>
#define v3i V<v2i>
#define vpi V<pi>
#define vsi V<si>
#define vb V<bool>
#define pb push_back
//sets
#define S set
#define MS multiset
#define US unordered_set
#define si S<int>
#define msi MS<int>
#define usi US<int>
#define ins insert
#define era erase
//maps
#define M map
#define UM unordered_map
#define mii M<int,int>
#define mivi UM<int,vi>
#define misi UM<int,si>
#define umii UM<int,int>
#define umivi UM<int,vi>
#define umisi UM<int,si>
//queues
#define Q queue
#define PQ priority_queue
#define qi Q<int>
#define qpi Q<pi>
#define pqi PQ<int>
#define rpqi PQ<int,vi,greater<int> >
#define pqpi PQ<pi>
#define rpqpi PQ<pi,vpi,greater<pi> >
//constants
const int MOD=998244353;
const int INF=922337203685477580;
//nt functions
int binpow(int a, int b, int m=MOD) {
a%=m; int res=1;
while (b>0) {
if (b&1) res=res*a%m;
a=a*a%m;
b>>=1;
}
return res;
}
int gcd (int a, int b) {
return b?gcd (b,a%b):a;
}
int lcm (int a, int b) {
return a/gcd(a,b)*b;
}
int inv(int i, int m=MOD) {
return binpow(i, m-2, m);
}
const int N=2e5+10;
int T,n;
struct zj{
int a,b,id;
}a[N];
ll sum;
int m,b[N];
int ta[N<<2],tb[N<<2];
ll sa[N<<2],sb[N<<2];
void pushup(int rt){
ta[rt]=ta[rt<<1]+ta[rt<<1|1];
sa[rt]=sa[rt<<1]+sa[rt<<1|1];
tb[rt]=tb[rt<<1]+tb[rt<<1|1];
sb[rt]=sb[rt<<1]+sb[rt<<1|1];
}
int cnt[N];
void build(int l=1,int r=m,int rt=1){
if(l==r){
ta[rt]=sa[rt]=0;
tb[rt]=cnt[l],sb[rt]=1ll*cnt[l]*b[l];
return;
}
int mid=(l+r)>>1;
build(l,mid,rt<<1);
build(mid+1,r,rt<<1|1);
pushup(rt);
}
void update(int x,int l=1,int r=m,int rt=1){
if(l==r){
ta[rt]++,tb[rt]--;
sa[rt]+=b[x],sb[rt]-=b[x];
return;
}
int mid=(l+r)>>1;
x<=mid?update(x,l,mid,rt<<1):update(x,mid+1,r,rt<<1|1);
pushup(rt);
}
void find(int &x,int &a,ll &s,int l=1,int r=m,int rt=1){
if(!x)return;
if(ta[rt]+tb[rt]<=x){
x-=ta[rt]+tb[rt];
s+=sa[rt]+sb[rt];
a+=ta[rt];
return;
}
if(l==r){
a+=min(x,ta[rt]);
s+=1ll*x*b[l];
x=0;
return;
}
int mid=(l+r)>>1;
find(x,a,s,l,mid,rt<<1);
find(x,a,s,mid+1,r,rt<<1|1);
}
ll queryA(int &x,int l=1,int r=m,int rt=1){
if(!x)return 0;
if(ta[rt]<=x)return x-=ta[rt],sa[rt];
if(l==r){
int tmp=x;
return x=0,1ll*tmp*b[l];
}
int mid=(l+r)>>1;
ll s=0;
s+=queryA(x,l,mid,rt<<1);
s+=queryA(x,mid+1,r,rt<<1|1);
return s;
}
ll queryB(int &x,int l=1,int r=m,int rt=1){
if(!x)return 0;
if(tb[rt]<=x)return x-=tb[rt],sb[rt];
if(l==r){
int tmp=x;
return x=0,1ll*tmp*b[l];
}
int mid=(l+r)>>1;
ll s=0;
s+=queryB(x,l,mid,rt<<1);
s+=queryB(x,mid+1,r,rt<<1|1);
return s;
}
int vis[N];
void cover(int l,int r,int x){
sort(a+l,a+1+r,[](zj x,zj y){return x.a<y.a;});
for(int i=l,j=1;j<=x;i++,j++)vis[a[i].id]=1;
}
void get(){
scanf("%d%lld",&n,&sum);
for(int i=1;i<=n;i++)a[i].id=i,scanf("%d%d",&a[i].a,&a[i].b);
for(int i=1;i<=n;i++)b[i]=a[i].a;
sort(b+1,b+1+n),m=unique(b+1,b+1+n)-b-1;
auto trs=[&](int &x){
x=lower_bound(b+1,b+1+m,x)-b;
};
for(int i=1;i<=n;i++)trs(a[i].a);
sort(a+1,a+1+n,[](zj x,zj y){return x.b<y.b;});
fill(cnt,cnt+1+m,0);
for(int i=1;i<=n;i++)cnt[a[i].a]++;
build();
int ans=0,pa=0,pb=0,cur=n;
for(int S=1,x=1;S<=n;S++){
for(;x<=n&&a[x].b<=S;x++){
update(a[x].a);
}
int cnt=0,tmp=S;
ll tot=0;
find(tmp,cnt,tot);
if(tot>sum)continue;
int l=cnt,r=min(S+1,x),mid;
for(;l+1<r;){
mid=(l+r)>>1;
int x=mid,y=S-mid;
if(queryA(x)+queryB(y)<=sum)l=mid;
else r=mid;
}
if(l>ans){
ans=l;
pa=l,pb=S-l,cur=x;
}
}
fill(vis,vis+1+n,0);
cover(1,cur-1,pa);
cover(cur,n,pb);
printf("%d\n%d",ans,pa+pb);
for(int i=1;i<=n;i++)if(vis[i])printf(" %d",i);
puts("");
}
int main(){
for(scanf("%d",&T);T--;)get();
cerr<<1.0*clock()/CLOCKS_PER_SEC<<endl;
return 0;
}