// Arup Guha
// 6/27/2012
// Second Solution to 2008 Southeast Regional Problem: Heart of the Country

// Note: This solution uses ArrayList and could be relatively slow,
// but it runs fast enough on the contest data.

import java.util.*;

class vertex {

	public int id;
	public int troops;
	public ArrayList<Integer> next;

	public vertex(int num, int numtroops, int[] adj) {
		id = num;
		troops = numtroops;
		next = new ArrayList<Integer>();
		for (int i=0; i<adj.length; i++)
			next.add(adj[i]);
	}
}

public class b2 {

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);

		int N = stdin.nextInt();
		int K = stdin.nextInt();

		while (N != 0) {

			vertex[] graph = new vertex[N];

			// Read in the graph.
			for (int i=0; i<N; i++) {
				int troops = stdin.nextInt();
				int numadj = stdin.nextInt();
				int[] list = new int[numadj];
				for (int j=0; j<numadj; j++)
					list[j] = stdin.nextInt();
				graph[i] = new vertex(i, troops, list);
			}

			solve(graph, K);

			N = stdin.nextInt();
			K = stdin.nextInt();
		}
	}

	public static void solve(vertex[] graph, int K) {

		ArrayList<Integer> weak = findWeak(graph, K);

		// Continually remove weak vertices until there are none to remove.
		while (weak.size() > 0) {
			remove(graph, weak);
			weak = findWeak(graph, K);
		}

		// Then, just count up your answer.
		int cities = 0, troops = 0;
		for (int i=0; i<graph.length; i++) {
			if (graph[i] != null) {
				cities++;
				troops += graph[i].troops;
			}
		}

		System.out.println(cities+" "+troops);
	}


	// Returns a list of the weak vertices in the graph.
	public static ArrayList<Integer> findWeak(vertex[] graph, int K) {

		ArrayList<Integer> ans = new ArrayList<Integer>();

		// Check if vertex i is weak.
		for (int i=0; i<graph.length; i++) {

			// Not in the graph anymore...
			if (graph[i] == null) continue;

			// Add up it and all neighbors.
			int sum = graph[i].troops;
			for (int j=0; j<graph[i].next.size(); j++) {
				sum += graph[graph[i].next.get(j)].troops;
				if (sum >= K)
					break;
			}

			// This node is weak, so add it to our set.
			if (sum < K)
				ans.add(i);
		}

		return ans;
	}

	// Remove vertices in weak from graph.
	public static void remove(vertex[] graph, ArrayList<Integer> weak) {

		// The easy part of the removal.
		for (int i=0; i<weak.size(); i++)
			graph[weak.get(i)] = null;

		// Now, we have to go back and remove these nodes from existing neighbor lists.
		for (int i=0; i<graph.length; i++)
			if (graph[i] != null)
				for (int j=0; j<weak.size(); j++)
					graph[i].next.remove(weak.get(j));
	}
}