n,U,c[20],R[20],a,i;
S(k,s,A,m,b){
	if(s<U){
		b=1;
		k<n&&S(k+1,s,A,m)+S(k+1,s+c[k],A|1<<k,m+1);
	}else{
		b=0;
		for(i=n;i--;)
			b|=A&1<<i&&A&R[i]^R[i];
	}
	m<a*!b?a=m:0;
}
main(k,t){
	for(;scanf("%d%d",&n,&U)*n;S(0,0,0,0),printf("%d \n",a))
		for(a=i=n;i--;)
			for(R[i]=!scanf("%d%d",c+i,&k);k--;R[i]|=1<<t)
				scanf("%d",&t);
}