peterverebics/CodeNet_Python_118 huggingface dataset:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n, k = list(map(int, readline().split()))

    snuke = [False] * n

    for i in range(k):
        d = int(input())
        a = list(map(int, readline().split()))
        for num in a:
            snuke[num-1] = True

    ans = snuke.count(False)
    print(ans)

if __name__ == '__main__':
    main()
N, K = map(int, input().split())
no_okashi = set(range(1, N+1))

for _ in range(K):
  num_hito = int(input())
  has_okashi = set(map(int, input().split()))
  no_okashi = no_okashi - has_okashi
  
print(len(no_okashi))
n, k = [int(x) for x in input().split()]

temp_list = [1] * (n + 1)
temp_list[0] = 0
for _ in range(k):
    d = int(input())
    a_list = [int(x) for x in input().split()]
    for a in a_list:
        temp_list[a] = 0
print(sum(temp_list))
def main():
    n, k = map(int, input().split())
    snack = set()
    for _ in range(k):
        input()
        a = set(list(map(int, input().split())))
        snack |= a
    print(n-len(snack))
        

if __name__ == "__main__":
    main()
N,K=list(map(int,input().split()))

d=[0]*K
A=[[0]*K]*100
sunuke=[0]*N
count=N

for i in range(K):
    d[i]=int(input())
    A[i]=list(map(int,input().split()))
    for j in range(d[i]):
        if sunuke[A[i][j]-1]==0:
            sunuke[A[i][j]-1]=1
            count-=1

print(count)
n,k=map(int, input().split())
pepele=set()
for _ in range(k):
    candies = input()
    pepele |= set(map(int, input().split()))

# listから重複を削除し
print(n-len(pepele))
#!/usr/bin/env python
from collections import deque, defaultdict
from itertools import combinations, combinations_with_replacement
import bisect
from math import factorial, sqrt, log, ceil, floor

def main():
    N, K = map(int, input().split())

    s = set(range(1, N+1))
    for k in range(K):
        d = int(input())
        As = list(map(int, input().split()))
        for a in As:
            if a in s:
                s.remove(a)

    print(len(s))

if __name__ == '__main__':
    main()
N,K = map(int,input().split())
A = [[0 for j in range(K)]for i in range(K)]
B = [0 for j in range(N)]
S = 0
for i in range(K):
    d = int(input())
    A[i] = list(map(int,input().split()))
for i in range(K):
    for j in range(len(A[i])):
        for k in range(N):
            if A[i][j] == k+1:
                B[k] = 1
for i in range(N):
    if B[i] != 1:
        S += 1
print (S)
N,K = map(int, input().split())
A = []
for i in range(K) :
    d = int(input())
    A.append(input().split(" "))
    
snukeList = []
for i in range(len(A)) :
    for j in range(len(A[i])) :
        snukeList.append(int(A[i][j]))
count = 0
for i in range(1, N+1) :
    if i in snukeList :
        continue
    count += 1
print(count)
n,k=map(int,input().split())
l=[1]*n
for i in range(k):
  d=int(input())
  a=list(map(int,input().split()))
  for j in range(d):
    l[a[j]-1]=0
print(sum(l))
n, k = map(int, input().split())

lis = []
for i in range(k):
    d = int(input())
    lis += list(map(int, input().split()))
print(n - len(set(lis)))
N, K = list(map(int, input().split()))

table = [0] * N
for _ in range(K):
  num = int(input())
  have_list = list(map(int, input().split()))
  for child in have_list:
    table[child-1] += 1

print(str(table.count(0)))
import itertools
N,K=map(int,input().split())
l=[0]*N
n=0
for i in range(K):
  d=int(input())
  have=list(input().split())
  for j in have:
    l[int(j)-1]=1

for i in range(N):
  if l[i]==0:
    n+=1
print(n)
n, k = map(int ,input().split(" "))

d = {}
for i in range(1, k+1):
    _ = input()
    A = map(int, input().split(" "))
    for a in A:
        tmp = d.get(a, [])
        tmp.append(i)
        d[a] = tmp

ans = 0
for i in range(1, n+1):
    if i not in d:
        ans = ans + 1

print(ans)
N,K = map(int, input().split())
A = [0]*N
for _ in range(K):
    d1 = int(input())
    A_ins = list(map(int, input().split()))
    for i in A_ins:
        A[i-1] += _+1
print(A.count(0))
n, k = map(int, input().split())

mp = [0] * n
for _ in range(k):
  d = int(input())
  a = list(map(int, input().split()))
  for i in range(d):
    mp[a[i] - 1] = mp[a[i] - 1] + 1

ans = 0
for i in range(n):
  if mp[i] == 0:
    ans = ans + 1

print(ans)
def main():
  n, k = map(int, input().split())
  a = set()
  for i in range(k):
    input()
    a |= set(list(map(int, input().split())))
  print(n-len(a))

if __name__ == "__main__":
  main()
N, K = map(int, input().split())
sN = [1]*N
for i in range(K):
    d = int(input())
    As = list(map(int, input().split()))
    for a in As:
        sN[a-1] = 0
print(sum(sN))
n, k = map(int, input().split())
snk = [-1] * (n+1)
ans = 0
for j in range(k):
	d = int(input())
	lis = list(input().split())
	for i in range(d):
		y = int(lis[i])
		snk[y] = 0
for j in range(n):
    if snk[j+1] == -1:
        ans += 1
print(ans)
n,k=(int(i) for i in input().split())
l=[0 for i in range(n)]
for i in range(k):
  d=int(input())
  for j in input().split():
    j=int(j)
    if l[j-1]==0:
      l[j-1]=1
print(n-sum(l))
n,k=map(int,input().split())
d=[]
al=[]
a=[0]*k
for i in range(k):
  d.append(int(input()))
  a[i]=input().split()
  for j in range(d[i]):
    al.append(a[i][j])
  
al=set(al)
print(str(n-len(al)))
N,K=list(map(int,input().split()))
h=[]
for k in range(K):
    d_i=int(input())
    a=list(map(int,input().split()))
    for i in range(d_i):
        h.append(a[i])
h2=set(h)
ans=N-len(h2)
print(ans)
N, K = map(int, input().split())

Victims = [True] * N

for _ in range(K):
    Snack = int(input())
    Snukes = list(map(int, input().split()))
    for snuke in Snukes:
        Victims[snuke - 1] = False

print(Victims.count(True))
n, k = map(int, input().split())

L = list(range(1, n+1))
for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    L = [j for j in L if j not in a]

print(len(L))
import collections
n,k=map(int,input().split())
a=[]
for i in range(0,k):
  d_i=int(input())
  a_i=list(map(int,input().split()))
  a=a+a_i
a=collections.Counter(a)
print(n-len(a))
# Trick or Treat
N, K = map(int,input().split())
sweets = [0]*N
for _ in range(K):
    d = int(input())
    A = list(map(int,input().split()))
    for a in A:
        sweets[a-1] += 1
ans = sum([e == 0 for e in sweets])
print(ans)
N, K = map(int, input().split())
ans = {i+1 for i in range(N)}
for i in range(K):
    d = int(input())
    a = set(map(int, input().split()))
    ans = ans - a

print(len(ans))
N, K = map(int, input().split())
l = []
for _ in range(K):
  d = int(input())
  l_K = list(map(int, input().split()))
  l += l_K
l = set(l)
print(N-len(l))
n,k = map(int, input().split())

sunuke = [0]*n

for i in range(k):
    d = int(input())
    c = list(map(int, input().split()))

    for candidate in c:
        sunuke[candidate-1] = 1

print(sunuke.count(0))
n,k = [int(x) for x in input().split()]
li = [0]*n
for i in range(k):
    d = int(input())
    a = [int(x)-1 for x in input().split()]
    for j in a:
        li[j] = 1
print(li.count(0))
n, k = map(int, input().split())
s = set()
for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for j in a:
        s.add(j)

print(n-len(s))
N,K = map(int,input().split())
A =[]
B =[]
count = 0
for _ in range(K):
  d = int(input())
  B = list(map(int,input().split()))
  A += B
set(A)

for i in range(1,N+1):
  if not i in list(A):
    count += 1
print(count)
n,k = map(int,input().split())
having = set([])
for _ in range(k):
    d = input()
    having = having.union(set(list(map(int,input().split()))))
print(n - len(having))
# B - Trick or Treat
n,k = map((int),(input().split()))

sunuke = [0]*n

for i in range(0, k):
    d = (int)(input())
    a = list(map(int,(input().split())))
    for j in range(0, d):
        sunuke[a[j] - 1] = 1

sum = 0
for k in sunuke:
    if k == 0:
        sum += 1

print(sum)
def main():
    n, k = map(int, input().split())
    # d = [None] * k
    a = [None] * k
    ret = [1] * n
    for i in range(k):
        _ = input()
        for _a in map(int, input().split()):
            ret[_a-1] = 0
    print(sum(ret))



if __name__=="__main__":
    main()
n, k = map(int,input().split())
have = [False] * n
for _ in range(k):
    d = input()
    a = list(map(lambda x: int(x)-1, input().split()))
    for x in a:
        have[x] = True

print(have.count(False))
N, K = map(int,input().split())
LIST = []
for i in range(K): 
    d_i = int(input())
    # nest_list = [int(input()) for j in range(d_i)]
    nest_list = list(map(int,input().split())) 
    LIST.append(nest_list)

all_set = set(list(range(1, N+1)))
difference_set = all_set

for nest_list in LIST:
    nest_set = set(nest_list)
    difference_set = difference_set - nest_set 

print(len(difference_set))
n, k = map(int, input().split())
list = []

for i in range(k):
  dummy = int(input())
  ans = map(int, input().split())
  list.extend(ans)

print(n - len(set(list)))
n,k=map(int,input().split())
ans = [i for i in range(1,n+1)]
for i in range(k):
  input()
  a=list(map(int,input().split()))
  for j in a:
    if j in ans:
      ans.remove(j)
print(len(ans))
#! /Library/Frameworks/Python.framework/Versions/3.7/bin/python3
n, k = map(int, input().split())
ds = [0] * k
As = [0] * n

for i in range(k):
    ds[i] = input()
    A = list(map(int, input().split()))
    for a in A:
        As[a - 1] += 1
ans = 0
for A in As:
    if (A == 0):
        ans += 1

print(ans)
N,K = map(int, input().split())

arr=[]
arr1=[]
for i in range(1, N+1):
  arr1.append(i)

for i in range(K):
  d=input()
  A=list(map(int, input().split()))
  arr = arr+A
print(len(set(arr1) - set(arr)))
import sys
input = sys.stdin.readline
N, K = (int(i) for i in input().split())
# B = [int(x) for x in stdin.readline().rstrip().split()]
# A = [[int(i) for i in input().split()] for i in range(N)]
sunuke = [0]*(N+1)
for j in range(K):
    d = int(input())
    l = [int(i) for i in input().split()]
    for i in l:
        sunuke[i] += 1

# print(sunuke)
print(sunuke.count(0)-1)
n, k = map(int, input().split())
sunuke=[[]]*n
for i in range(k):
    d=int(input())
    lid=list(map(int, input().split()))
    for i2 in range(d):
        if d not in sunuke[lid[i2]-1]:
            sunuke[lid[i2]-1]=sunuke[lid[i2]-1] + [d]
ans=0
for item in sunuke:
    if item==[]:
        ans+=1
print(ans)
N, K = map(int, input().split())

result = [0 for i in range(N)]

for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for di in range(d):
        result[A[di] -1] = 1
        
print(N - sum(result))
import sys

def main():
  N, M = map(int, input().split())
  sunukes = set(range(1, N+1))
  
  is_skip = True
  for i in range(M*2):
    d = list(map(int, input().split()))
    if is_skip:
      is_skip = False
      continue

    sunukes = sunukes - set(d)
	
    is_skip = True

  print(len(list(sunukes)))
  
  
if __name__ == '__main__':
  main()
n,k = map(int,input().split())
p = []
for _ in range(k):
    d = int(input())
    a = list(map(int,input().split()))
    for i in range(d):
        if a[i] not in p:
            p.append(a[i])
print(n-len(p))
#!/usr/bin/env python3
n, k = map(int, input().split())
d = []
a = []

for _ in range(k):
    d.append(int(input()))
    a.append(list(map(int, input().split())))

check = [False] * n

for i in range(k):
    for j in a[i]:
        check[j-1] = True

ans = 0
for i in range(n):
    if not check [i]:
        ans += 1

print(ans)
# thx for https://qiita.com/taxfree_python/items/491269d25cb7bcd9965b
inList = input().split()
n = int(inList[0])
k = int(inList[1])

workList = [1] * n

for i in range(k):
    di = int(input())
    inList = input().split()
    for di in inList:
        workList[int(di)-1] = 0


print(sum(workList))
n, k = map(int, input().split())
have = [False] * n
for i in range(k):
    d = int(input())
    A = list(map(int, input().split()))
    for a in A:
        have[a-1] = True

print(sum([have[i] == False for i in range(n)]))
N, K = map(int, input().split())

N_li = [0 for i in range(N)]

for i in range(K):
    input()
    li = list(map(int, input().split()))
    for j in li:
        N_li[j-1] = 1

print(N - sum(N_li))
N, K = map(int, input().split())
lst = [0 for _ in range(N)]
for i in range(K):
  d = int(input())
  A = list(map(int, input().split()))
  for j in range(d):
    lst[A[j] - 1] += 1
print(lst.count(0))
N, K = map(int,input().split())
lists = []
listb = [1 for i in range(N)]

for i in range(K):
    d = int(input())
    lista = list(map(int, input().split()))
    lists.append(lista)

for i in lists:
    for j in i:
        listb[j-1] -= 1
    
cnt = 0

for i in listb:
    if i == 1:
        cnt += 1
        
print(cnt)
N,K=map(int,input().split())
d=[0 for i in range(K)]
X=[[0 for j in range(N)]for i in range(K)]
for i in range(K):
    d[i]=int(input())
    for j in input().split():
        X[i][int(j)-1]=1
ans=0
for j in range(N):
    flag=1
    for i in range(K):
        if X[i][j]==1:
            flag=0
            break
    if flag:
        ans+=1
print(ans)
#B
N, K=map(int,input().split())
d=[]
A=[]
for i in range(K):
    di=int(input())
    Ai=list(map(int,input().split()))
    d.append(di)
    A.append(Ai)
A_all=[]
for i in A:
    for j in i:
        A_all.append(j)
A_set=list(set(A_all))
print(N-len(A_set))
import numpy as np

N, K = list(map(int, input().split()))
d = []
A = []
for i in range(K):
  d.append(int(input()))
  A.append(list(map(int, input().split())))

A = sum(A, [])
ans = N - len(np.unique(A))
print(ans)
n, k = map(int, input().split())
l = [0]*n

for _ in range(k):
    d = int(input())
    al = list(map(int, input().split()))
    for a in al:
        l[a-1] += 1

print(l.count(0))
n, k = map(int, input().split())
d = []
a = []
for i in range(k):
    d.append(int(input()))
    a.append(list(map(int, input().split())))

tricked = [0] * n
for i in range(k):
    for j in range(d[i]):
        tricked[a[i][j]-1] = 1

print(n-sum(tricked))
N, K = map(int, input().split())

snukes = [0 for _ in range(N)]
for _ in range(K):
    d = int(input())
    A = map(int, input().split())
    for a in A:
        snukes[a - 1] += 1

print(snukes.count(0))
N, K = map(int, input().split())
A = []*N
for i in range(K):
  d = int(input())
  l = list(map(int, input().split()))
  for a in l:
    A.append(a)

A = set(A)
print(N - len(A))
n,k=map(int,input().split())
ans=[1]*n
for i in range(k):
  d=int(input())
  for j in list(map(int,input().split())):ans[j-1]=0
print(ans.count(1))
N,K=map(int,input().split())
n = []
for i in range(1 , N +1):
  n.append(i)


for i in range(K):
  di = int(input())
  arr= list(map(int,input().split()))
  for j in arr:
    if(j in n):
      n.remove(j)

print(len(n))
n,k=[int(_) for _ in input().split()]
s=set()
for a in range(k):
    x=int(input())
    y=[int(_) for _ in input().split()]
    for b in y:
        s.add(b)
print(len(set(range(1,n+1))-s))
n,k = map(int,input().split())
d = []
A = []
sunuke = [0 for _ in range(n)]
for i in range(k):
	d.append(int(input()))
	a = list(map(int,input().split()))
	for j in range(len(a)):
		sunuke[a[j]-1] += 1

count = 0
for i in sunuke:
	if i == 0:
		count += 1 

print(count)
import sys
import math

N,K=list(map(int,input().split()))

#d=list()
#A=list()

sunuke=list()
for i in range(N):
    sunuke.append(0)

for i in range(K):
    #d.append(int(input()))
    #A.append(list(map(int,input().split())))
    d=int(input())
    A=list(map(int,input().split()))

    for j in range(d):
        sunuke[A[j]-1] += 1

n=0
for i in range(N):
    if sunuke[i]==0:
        n+=1

print(n)
li = list(map(int, input().split()))
N, K = li[0], li[1]
d = []
A = []
for i in range(K):
    d.append(input())
    A.append(list(map(int, input().split())))
sunuke = list(range(1, N+1))
treated = []
for Ai in A:
    for x in Ai:
        if x not in treated:
            treated.append(x)
tricked = list(set(sunuke) - set(treated))
print(len(tricked))
n, k = map(int, input().split())
N = [0]*(n)
for i in range(k):
    d = int(input())
    A = list(map(int, input().split()))
    for j in A:
        if N[j-1]==0: N[j-1] = 1
print(n-sum(N))
N,K=map(int,input().split())
l=list(range(1,N+1))
for i in range(K):
  d=input()
  a =input().split()
  A=list(a)
  AA=[int(n) for n in A]
  l=[i for i in l if i not in AA]
  
print(len(l))
N,K = map(int,input().split())
A = []
for i in range(K):
    d1 = int(input())
    a = list(map(int,input().split()))
    A.append(a)
ans = {i:0 for i in range(1,N+1)}
for a in A:
    for d in a:
        ans[d] = 1
ans2 = 0
for j in ans.keys():
    if ans[j] == 0:
        ans2 += 1
print(ans2)
import numpy as np
N,K = map(int,input().split())
numberList = np.array(range(1,N+1)).tolist()
for d in range(1,K+1):
    num = input()
    array = list(map(int, input().strip().split()))
    for i in array:
        if i in numberList:
            numberList.remove(i)
print(len(numberList))
n,k = map(int,input().split())
ans = 0
list = [0] * n
for i in range(k):
    d = int(input())
    A = map(int,input().split())
    for j in A:
        list[j-1]+=1

for u in  list:
    if u == 0:
        ans += 1
        
print(ans)
N,K=map(int,input().split())

Sunuke=[1]*N
for i in range(K):
    d=int(input())
    A=list(map(int,input().split()))
    for ii in range(d):
        Sunuke[A[ii]-1]=0

print(sum(Sunuke))
n,k = map(int,input().split()) # n人、k個のお菓子

people = [1] * n

for i in range(k): #お菓子i
  x = int(input()) #お菓子iを持っている人数
  y = list(map(int,input().split()))
  for j in y:
    people[j-1] = 0

print(sum(people))
N,K = list(map(int, input().split()))

sunukes = [False] * N

for i in range(K):
    d = int(input())
    As = list(map(int, input().split()))

    for a in As:
        sunukes[a-1] = True    

cnt = 0
for v in sunukes:
    if not v:
        cnt += 1

print(cnt)
# -*- coding: utf-8 -*-
n, k = map(int, input().split())

sunuke_list = [False for i in range(n)]

for i in range(k):
    d = int(input())
    has_sunuke_list = input().split()
    for k in has_sunuke_list:
        sunuke_list[int(k)-1] = True

print(sunuke_list.count(False))
# ==B==
N, K = map(int, input().split())
acc = set()
for i in range(1, K+1):
	# loop for snack_i
	_ = int(input())
	for A in map(int, input().split()):
		acc.add(A)
print(N-len(acc))
def resolve():
	N, K = map(int, input().split())
	a = []*K
	for i in range(K*2): # 開始、終端、ステップ
		if i%2 == 0:
			_ = input()
		else:
			a.extend(list(map(int, input().split())))
	print(N - len(set(a)))

resolve()
N,K = map(int,input().split())

L = []
for count in range(N):
    L.append(0)

for count in range(K):
    d = int(input())
    Alist = list(map(int,input().split()))
    for count2 in range(len(Alist)):
        L[Alist[count2]-1] = 1

ans = 0
for count in range(N):
    if L[count] == 0:
        ans = ans + 1

print(ans)
n, k = map(int,input().split())
d = []
a = []
for i in range(k):
    d.append(int(input()))
    a.append(list(map(int,input().split())))

ans = set(sum(a, []))
print(n-len(ans))
n,k = input().split()
n = int(n)
k = int(k)
a = [True for i in range(n)]

while k>0:
    d = int(input())
    b = input().split()
    for e in b:
        a[int(e)-1] = False
    k-=1
print(sum(a))
import numpy as np
N, K = map(int, input().split())
snuke = np.zeros(N, dtype=int)
for n in range(K):
    snack = int(input())
    d_snuke = map(int, input().split())
    for d in d_snuke:
        snuke[d-1] = snack
print(N-np.count_nonzero(snuke, axis=0))
if __name__ == '__main__':
    N,K=input().split(" ")
    p=int(N)
    q=int(K)
    a=[0]*p
    judge=0
    for i in range(0,q):
        k=int(input())
        b=[int(t) for t in input().split()]
        for j in range(0,len(b)):
            a[b[j]-1]+=1
    for m in range(0,p):
        if a[m]==0:
            judge+=1
    print(judge)
if __name__=='__main__':
    n,k = map(int,input().split())
    have_okasi = [False for i in range(n)]
    for i in range(k):
        d = int(input())
        a = [int(x) for x in input().split()]
        for j in range(d):
            have_okasi[a[j]-1] = True
    print(have_okasi.count(False))
N,K = map(int,input().split())
D = []
A = []
for i in range(K):
  d = int(input())
  D.append(d)
  a = list(map(int,input().split()))
  A.append(a)

L = set(sum(A,[]))
print(N - len(L))
N,K=map(int,input().split())
count=0
a=[0]*N
for i in range(K):
  d=int(input())
  b=list(map(int,input().split()))
  for i in range(len(b)):
    a[b[i]-1]+=1
print(a.count(0))
N, K = map(int, input().split())
table = [[int(i) for i in input().split()] for _ in range(K * 2)]

ans_list = []
sunuke_set = set(list(range(1, N + 1)))

for i in range(1, K * 2 + 1, 2):
    ans_list += table[i]

ans_set = set(ans_list)

print(len(sunuke_set - ans_set))
n, k = map(int,input().split())
a = [0] * n
for i in range(k):
    d = int(input())
    #b = [0] * d
    b = list(map(int,input().split()))
    for j in range(d):
        a[b[j]-1] += 1

ans = 0
for i in range(n):
    if a[i]== 0:
        ans += 1

print(ans)
N,K=map(int,input().split())
check=[False]*N
for i in range(K):
    d=int(input())
    A=list(map(int,input().split()))
    for a in A:
        check[a-1]=True

cnt=0
for flag in check:
    if not flag:
        cnt+=1

print(cnt)
n,k = map(int,input().split())
nn = [0]*n
for _ in range(k):
    d = int(input())
    a = [int(i) for i in input().split()]
    for j in a:
        nn[j-1] += 1
c=0
for i in nn:
   if i==0:
       c+=1
print(c)
list_K = []
N,K = map(int,input().split())
for i in range(K):
    d = int(input())
    A = [int(j) for j in input().split()]
    for k in range(d):
        list_K.append(A[k])
list_K0 = list(set(list_K))
list_K0.sort()
list_N = list(range(1,N+1))
set_NK = set(list_N)-set(list_K0)
print(len(set_NK))
N, K = map(int, input().split())
a = []
for i in range(K):
  di = int(input())
  a += list(map(int, input().split()))

a = set(a)
print(N - len(a))
import itertools
N,K = map(int,input().split())
d=[]
A=[]
for i in range(K):
    d.append(int(input()))
    A.append(list(map(int,input().split())))
answer=N-len(set(itertools.chain.from_iterable(A)))
print(answer)
n,k=map(int,input().split())
l=[]
n_l=[]
for i in range(1,n+1):
    n_l.append(i)
#print(n_l)
for i in range(k):
    d = int(input())
    a = list(map(int,input().split()))
    for a_j in a:
        l.append(a_j)
l=list(set(l))    
#print(l)
ans=len(list(set(n_l)-set(l)))
print(ans)
N, K = list(map(int, input().split()))
ans = [1 for _ in range(N)]
for i in range(K):
	d = int(input())
	a = list(map(int, input().split()))
	for j in a:  ans[j - 1] = 0
print(sum(ans))
n, k = map(int, input().split())
sunukes = [list(map(int, input().split())) for i in range(k*2)]

names = list(range(1,n+1))
for i in range(0,k):
  j = i*2
  syoji = sunukes[j]
  okashi = sunukes[j+1]
  for n in okashi:
    if n in names:
      names.remove(n)

print(len(names))
N, K = map(int, input().split())

cur = [1] * N
for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for j in A:
        cur[j-1] = 0

print(sum(cur))
x = input().split()
n = int(x[0])
k = int(x[1])*2
s = [input().split() for i in range(k)]
l = []
for i in range(0, k):
  if i%2 != 0:
    for j in range(1, n+1):
      if (str(j) in s[i]) == True:
        l.append(j)
        pass
count = 0
for i in range(1, n+1):
  if (i in l) == False:
    count += 1
print(count)
n,k = map(int,input().split())
lst = [0] * n
ans = 0

for i in range(k):
  lenc = int(input())
  candy = input().split()
  for c in range(lenc):
    #print(candy[c])
    lst[int(candy[c])-1] += 1
#
#print(lst)
for i in lst:
  if i == 0:
    ans += 1
#

print(ans)
N, K = map(int, input().split())
A = [0 for i in range(N)]

for i in range(K):
    d = int(input())
    a = [int(i) for i in input().split()]
    for j in a:
        A[j-1] += 1
    
print(A.count(0))
N, K = map(int, input().split())
snukes = []

for k in range(K):
    d = int(input())
    a = list(map(int, input().split()))
    snukes += a

print(N - len(set(snukes)))
N, K = map(int, input().split())

d = []
l = []
i = 0

while i < 2*K:
  i += 1
  if i % 2 == 0:
    l.extend([int(x) for x in input().split()])
  else:
    d.append(int(input()))

L = list(set(l))
print(N - len(L))
n, k = map(int,input().split())

s = [False] * n

for i in range(k):
    d = int(input())
    a = list(map(int,input().split()))
    for j in a:
        s[j - 1] = True

ans = 0
for t in s:
    if t == False:
        ans += 1

print(ans)