n,m=map(int,input().split())
cnt=[n for _ in range(m)]
for i in range(n):
	k = list(map(int,input().split()))
	for i in range(1, k[0]+1):
		cnt[k[i]-1] -= 1
ans = 0
for i in range(m):
	if cnt[i] == 0:
		ans += 1
print(ans) n,m=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m n for _ in range(m) for _ in range(m) _ range(m) range m for _ in range(m) n cnt=[n for _ in range(m)] cnt [n for _ in range(m)] for i in range(n):
	k = list(map(int,input().split()))
	for i in range(1, k[0]+1):
		cnt[k[i]-1] -= 1 i range(n) range n k = list(map(int,input().split())) k list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split for i in range(1, k[0]+1):
		cnt[k[i]-1] -= 1 i range(1, k[0]+1) range 1 k[0]+1 k[0] k 0 1 cnt[k[i]-1] -= 1 cnt[k[i]-1] cnt k[i]-1 k[i] k i 1 1 ans = 0 ans 0 for i in range(m):
	if cnt[i] == 0:
		ans += 1 i range(m) range m if cnt[i] == 0:
		ans += 1 cnt[i] == 0 cnt[i] cnt i 0 ans += 1 ans 1 print(ans) print ans n,m=map(int,input().split()) map(int,input().split()) n m=map(int,input().split()) map(int,input().split()) m ans += 1 1 ans k = list(map(int,input().split())) list(map(int,input().split())) k cnt=[n for _ in range(m)] [n for _ in range(m)] cnt ans = 0 0 ans
n,m=map(int,input().split())
cnt=[n for _ in range(m)]
for i in range(n):
	k = list(map(int,input().split()))
	for i in range(1, k[0]+1):
		cnt[k[i]-1] -= 1
ans = 0
for i in range(m):
	if cnt[i] == 0:
		ans += 1
print(ans)