#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld =long double;
const ld eps = 1e-9;

bool solve(bitset<18>bs, vector<vector<int>>&dp,const vector<pair<int,int>>&vs,const int now) {
	if(dp[now][bs.to_ulong()]!=-1)return dp[now][bs.to_ulong()];

	bool ok = false;
	if(bs.count()==vs.size())ok=true;
	else {
		for (int i = 0; i < vs.size(); ++i) {
			if (bs[i]) {

			}
			else {
				if (vs[i].first == now || now == 7) {
					bs[i] = true;
					bool aok = solve(bs, dp, vs, vs[i].second);
					if (aok)ok = true;
					bs[i] = false;
				}
				if (vs[i].second == now || now == 7) {
					bs[i] = true;
					bool aok = solve(bs, dp, vs, vs[i].first);
					if(aok)ok=true;
					bs[i] = false;
				}
			}
		}
	
	}
	return dp[now][bs.to_ulong()]=ok;
}

void solve(vector<int>&memo,const int rest,const vector<int>&values, const vector<vector<int>>&rev_edges, int sum, int now,const vector<int>&perms,int&ans) {
	if (rest <= 0) {
		ans=min(ans,sum);
		return ;
	}
	else if (now == values.size()) {
		return;
	}
	else {
		solve(memo,rest,values,rev_edges,sum,now+1,perms,ans);

		bool ok=true;
		for (auto re : rev_edges[perms[now]]) {
			if(!memo[re])ok=false;
		}
		if (ok) {
			memo[perms[now]]=true;
			solve(memo,rest-values[perms[now]],values,rev_edges,sum+1,now+1,perms,ans);
			memo[perms[now]]=false;
		}
	}

}
int main()
{
	while (true) {
		int N,U;cin>>N>>U;
		if(!N)break;
		vector<int>values(N);
		vector<vector<int>>edges(N);
		vector<vector<int>>rev_edges(N);
		vector<int>comes(N);
		for (int i = 0; i < N; ++i) {
			int c,k;cin>>c>>k;
			values[i]=c;
			for (int j = 0; j < k; ++j) {
				int a;cin>>a;
				edges[a].push_back(i);
				rev_edges[i].push_back(a);
				comes[i]++;
			}
		}
		
		queue<int>que;
		for (int i = 0; i < N; ++i) {
			if (comes[i] == 0) {
				que.push(i);
			}
		}
		vector<int>perms;
		while (!que.empty()) {
			int atop(que.front());
			que.pop();
			perms.push_back(atop);
			for (auto e : edges[atop]) {
				comes[e]--;
				if (comes[e] == 0) {
					que.push(e);
				}
			}
		}
		vector<int>rev_perms(N);
		for (int i = 0; i < N; ++i) {
			rev_perms[perms[i]]=i;
		}
		int ans=100;
		vector<int>memo(N);
		solve(memo,U,values,rev_edges,0,0,perms,ans);
		cout<<ans<<endl;
	}
	return 0;
}
