n,U,c[20],R[20],a;S(k,s,A,m){int i;if(s>=U){for(i=n;i--;)if(A&1<<i&&A&R[i]^R[i])return;m<a?a=m:0;}else if(k<n){S(k+1,s,A,m);S(k+1,s+c[k],A|1<<k,m+1);}}main(i,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);for(i=9e5;i--;)getchar();exit(0);}