peterverebics/CodeNet_Python_118 huggingface dataset:
n,k=map(int,input().split())
ki=[]
ai=[]
for i in range(1,k+1):
  ki.append(int(input()))
  ai.append(list(map(int,input().split())))

s=list(range(1,n+1))

for i in range(1,k+1):
  for j in range(len(ai[i-1])):
    if ai[i-1][j-1] in s:
      s.remove(ai[i-1][j-1])
    
print(len(s))
N, K = input().split(" ")
N, K = int(N), int(K)
d = []
A = []
for k in range(K):
    d.append(int(input()))
    A += [int(a) for a in input().split(" ")]

ans = 0
for n in range(N):
    if A.count(n+1) == 0:
        ans += 1
print(ans)
n,k=map(int,input().split())
li=[0]*n

for _ in range(k):
  d=int(input())
  a=list(map(int,input().split()))
  
  for i in a:
    li[i-1]+=1
    
print(li.count(0))
def main():
  N, K = input().split()
  N = int(N)
  K = int(K)

  s = set()

  for k in range(K):
    d = int(input())
    A = input().split()
    for i in range(d):
      s.add(A[i])
  
  print(N - len(s))



if __name__ == "__main__":
    main()
n,k = map(int,input().split())
count = [0]*n
for _ in range(k):
    d = int(input())
    a = map(int,input().split())
    for i in a:
        count[i-1]+=1
        
ans = 0
for i in count:
    if i == 0:
        ans += 1
    
print(ans)
n,k = map(int,input().split())
A = set([i for i in range(1,n+1)])
B = set()
for _ in range(k):
    input()
    tmp = list(map(int,input().split()))
    B = B | set(tmp)
ans = A-B
print(len(ans))
N,K=map(int,input().split())
a=[]
for i in range(K):
    d=int(input())
    k=list(map(int,input().split()))
    a.append(k)
b=[]
for m in range(K):
    b+=a[m]
b=set(b)
ans=N-(len(b))
print(ans)
N,K = list(map(int,input().split()))
lst = [0]*N
for i in range(K):
    d = int(input())
    for Ai in list(map(int,input().split())):
        lst[Ai-1] += 1

ans = 0
for num in lst:
    if num == 0:
        ans += 1
print(ans)
N,K = [int(x.strip()) for x in input().split()]

L = [True] * N
for i in range(K):
    d = input()
    l = [int(a.strip()) for a in input().split()]
    for a in l:
        L[a-1] = False

ans = sum(v==True for v in L)
print(ans)
import itertools
N,K=map(int,input().split())
A=[]
for i in range(K*2):
    a=list(map(int,input().split()))
    if i%2==1:
        A.append(a)
x=list(itertools.chain.from_iterable(A))
print(N-len(set(x)))
N, K = map(int, input().split())
d = []
A =[0]*N
for i in range(K):
    d=input()
    a = list(map(int, input().split()))
    for i in a:
        A[i-1]+=1
print(A.count(0))
n,k= map(int, input().split())

li=[0]*n
for i in range(k):
        d=int(input())
        lis = list(map(int,input().split()))
        for j in range(len(lis)):
                li[lis[j]-1]+=1
        lis.clear
cnt=0
for i in range(len(li)):
        if li[i]==0:
                cnt+=1

print(cnt)
N, K = [int(i) for i in input().split()]
cnt = 0
sunuke_dict = {}
for i in range(1, N+1):
    sunuke_dict[i] = 0
    
while cnt < K:
    cnt += 1
    d = int(input())
    sunuke_list = [int(i) for i in input().split()]
    for sunuke in sunuke_list:
        sunuke_dict[sunuke] = 1

result = [key for key, value in sunuke_dict.items() if value == 0]
print(len(result))
n,k=map(int,input().split())
hoge=[0 for i in range(n)]
for i in range(k):
  aaa=int(input())
  huga=list(map(int,input().split()))
  for j in range(len(huga)):
    hoge[huga[j]-1]+=1
ans=0
for i in range(n):
  if(hoge[i]==0):
    ans+=1
print(ans)
n,k=map(int,input().split())
ans=[1]*n
for i in range(k):
  d=int(input())
  a=list(map(int,input().split()))
  for i in range(d):
    ans[a[i]-1]=0
print(sum(ans))
N, K = map(int, input().split())

treats = [False] * N
for _ in range(K):
	d = int(input())
	As = map(int, input().split())
	for A in As:
		treats[A - 1] = True

count = 0
for t in treats:
	if not t:
		count += 1

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

sunuke = [0]*n

for i in range(k):
    d = int(input())
    a = [int(e)-1 for e in input().split()]
    for j in range(d):
        sunuke[a[j]] += 1

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

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

    for e in a:
        t[e-1] += 1
ans = 0
l = [i for i in t if i == 0]
# print(l)
print(len(l))
n,k=map(int,input().split())
check=[0]*n
ans=0
for i in range (k):
  d=int(input())
  l=list(map(int,input().split()))
  for j in range(d):
    h=l[j]
    check[h-1]+=1
    
for k in range(n):
  if check[k]==0:
    ans+=1

print(ans)
N, K = map(int, input().split())
okashi_set = set([])
for i in range(K):
    d_i = int(input())
    A_d = list(map(int, input().split()))
    for A_d_j in A_d:
        okashi_set.add(A_d_j)
print(N-len(okashi_set))
n, k = map(int, input().split())
ans = []
count = 0

for i in range(k):
  d = int(input())
  l = list(map(int, input().split()))
  for j in range(d):
    if l[j] not in ans:
      ans.append(l[j])
  
print(n - len(ans))
n, k = list(map(int, input().split()))


l = set()
d = [input().split() for _ in range(k*2)]
for i in range(len(d)):
	if i % 2 == 1:
		l = l | set(d[i])
print(n - len(l))
n,k = map(int,input().split())
s = set()
for i in range(k):
    d = input()
    a = input().split()
    s |= set(a)
print(n-len(s))
n, k = map(int, input().split())

d = [0] * k
a = [0] * k
sunuke = [0] * n

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

print(sunuke.count(0))
N, K = map(int, input().split())
d = []
A = []

s0 = set([i for i in range(1,N+1)])
s1 = set()

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

    for j in range(d[i]):
        s1.add(A[i][j])

s_diff = s0 - s1

print(len(s_diff))
n, k = map(int, input().split())
nn = set(range(1,n+1))

for i in range(k):
    input()
    a = set(map(int, input().split()))
    nn -= a

print(len(nn))
N, K = map(int, input().split())
A = []

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

s = set()
for i in range(K):
    for a in A[i]:
        s.add(a)

# print(s)
print(N - len(s))
n, k = map(int, input().split())
a = []

for _ in range(k):
  d = int(input())
  a += [int(m) for m in input().split()]

print(n - len(set(a)))
import collections
N,K=map(int,input().split())
a=[]
d=[]
while K>0:
  K=K-1
  d.append(int(input()))
  b=list(map(int,input().split()))
  a.extend(b)
e=collections.Counter(a)
print(N-len(e))
N,K = map(int, input().split())

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

print(A.count(0))
N,K=map(int,input().split())
A=[]

for _ in range(K):
    d=int(input())
    A.append(list(map(int,input().split()))) 
print(N-len(set(sum(A,[]))))
n, k=map(int,input().split())

c=[0]*n

for i in range(k):
    d = int(input())
    a=list(map(int,input().split()))
    for i in range(len(a)):
        c[a[i]-1]+=1

print(c.count(0))
n, k = map(int, input().split())

data = [0] * n

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

    for j, val in enumerate(people):
        tar = val - 1
        data[tar] += 1

ans = 0

for i in data:
    if (i == 0):
        ans += 1
print(ans)
n,k = map(int,input().split())

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

cnt = 0
for i in okashi:
    if i == 0:
        cnt += 1

print(cnt)
n, k = map(int, input().split())
b = [0]*n
for _ in range(k):
  a = int(input())
  c = list(map(int, input().split()))
  for i in c:
    b[i-1] = 1  
print(b.count(0))
s = input().split();
n = int(s[0])
k = int(s[1])

A= [0 for i in range(n)]
ans = n
for i in range(k):
	d = input() 
	d = int(d)
	a =  list(map(int, input().split()))
	
	for j in range(d):
		if A[a[j]-1]== 0:
			A[a[j]-1]=1
			ans = ans -1
		else:
			continue

print(ans)
n, k = map(int, input().split())
d = []
a = []
for i in range(k):
    d.append(int(input()))
    line = list(map(int, input().split()))
    a += line
a_set = set(a)
cnt = 0
for i in range(1,n+1):
    if not i in a_set:
        cnt += 1
print(cnt)
n, k = map(int, input().split())
S = [0]*n
for i in range(k):
    d = int(input())
    A = list(map(int, input().split()))
    for j in range(len(A)):
        S[A[j]-1]+=1

print(S.count(0))
N,K = map(int,input().split())
sunuke = [0] * N
for i in range(K):
    tmp = int(input())
    tmp_lst = list(map(int,input().split()))
    for j in tmp_lst:
        sunuke[j-1] += 1
print(sunuke.count(0))
n,k = map(int,input().split())

d = []
a = []

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

print(sum(ans))
n, k =map(int, input().split())  #複数数値入力
d = []
a = []
for i in range(k):
    d.append(int(input()))
    ai = list(map(int, input().split()))  #リスト入力
    a.append(ai)
a = sum(a, [])
a = list(set(a))

aset = list(set(a))

result = 0
for i in range(1,n+1):
    if i in aset:
        continue
    else:
        result += 1

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

B = [0]*N

for i in range(K):
    d = int(input())
    A = list(map(int,input().split()))
    for j in range(N):
        if j+1 in A:
            B[j] = 1

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

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

print(len(person))
n, k = map(int, input().split())

ha = [0] * n
for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))

    for j in range(d):
        buf = a[j]-1
        ha[buf] += 1

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

print(ans)
import sys

sys.setrecursionlimit(1000000)



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

    has_set = set()
    a_dic = {}
    for i in range(k):
        input()
        for z in list(map(int, input().split())):
            has_set.add(z)

    print(n-len(has_set))




main()
n, k = list(map(lambda x: int(x),input().split(' ')))

has_cookie = []
for i in range(k):
  cookie_num = int(input())
  has_cookie.extend(list(map(lambda x: int(x), input().split(' '))))

has_cookie = list(set(has_cookie))

print(n - len(has_cookie))
#!/usr/bin/env python3

n, k = map(int, input().split())
have = []
for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for j in a:
        if j not in have:
            have.append(j)
print(n - len(have))
N, K = (int(i) for i in input().split())

flag = [True]*N
for k in range(K):
  tmp = input()
  for i in list(map(int,input().split())):
        flag[i-1] = False
 
print(sum(1 for x in flag if x==True))
n,k=map(int,input().split())

trick=[True]*n

for i in range(k):
    input()
    a_lis=list(map(int,input().split()))
    for a in a_lis:
        trick[a-1]=False


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

print(ans)
n, k=map(int, input().split())

a = []
for i in range(k):
  int(input())
  x = list(map(int, input().split()))
  b = a + x
  a = list(set(b))
print(n - len(a))
N, K = map(int, input().split())
sunukes = [0 for k in range(N)]
for k in range(K):
  d = int(input())
  A = list(map(int, input().split()))
  for a in A:
    sunukes[a-1] += 1
  assert len(A) == d
print(len([k for k in sunukes if k == 0]))
N,K = map(int, input().split())
A=[]
d=[0 for i in range(K)]
recode={}
for i in range(K):
    d[i]=int(input())
    a=list(map(int, input().split()))
    A.append(a)
for i in range(K):
    for j in range(d[i]):
        recode[A[i][j]]=1
count=0
for i in range(1,N+1):
    if i in recode.keys():
        continue
    else:
        count+=1
print(count)
n, k = map(int, input().strip().split())
sunuke=[False]*n
for i in range(k):
    d=int(input().strip())
    L = list(map(int, input().strip().split()))
    for j in L:
        sunuke[j-1]=True
ans=0
for i in sunuke:
    if not i:
        ans+=1
print(ans)
N, K = map(int, input().split())
okashi_map = {}

for num in range(N):
    okashi_map[num+1] = 0

for _ in range(K):
    okashi = input()
    sunuke_list = list(map(int, input().split()))
    for sunuke in sunuke_list:
        okashi_map[sunuke] += 1

find_keys = [k for k, v in okashi_map.items() if v == 0]

print(len(find_keys))
N , K = map(int,input().split())
dA = [list(map(int,input().split()))for k in range(2*K)]

L = list(sum(dA[1::2],[]))
print(N-len(set(L)))
N, K = map(int, input().split())

d = []
A_set = set()

for i in range(K):
  d_i = int(input())
  A = list(map(int, input().split()))
  for j in A:
    A_set.add(j)

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

d = list()
s = set()
for _ in range(k):
    d = int(input())
    A = list(map(int, input().split()))
    for a in A:
        s.add(a)

c = 0
for i in range(1, n+1):
    if i not in s:
        c += 1

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

s = set()

#K種類ループ
for i in range(K):
  d = int(input())
  ad = list(map(int,input().split()))
  for a in range(d):
    s.add(ad[a])

print(N - len(s))
n, k = map(int, input().split())

a = [0]*n
for i in range(k):
    d = int(input())
    s = list(map(int, input().split()))
    for j in range(d):
        a[s[j]-1] = 1
cnt = 0
for i in range(n):
    if a[i] == 0:
        cnt += 1
        
print(cnt)
N, K = map(int, input().split())
d = []
A = []

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

Alist = [e for row in A for e in row]
        
L = len(list(set(Alist)))
print(N-L)
n,k = map(int,input().split())

d_list = []
a_list = []
for k_tmp in range(k):
    d_tmp=int(input())
    d_list.append(d_tmp)
    a_list_tmp = list(map(int,input().split()))
    a_list.append(a_list_tmp)

ans_set = set()
for i in range(len(a_list)):
    for j in range(len(a_list[i])):
        ans_set.add(a_list[i][j])

print(n - len(ans_set))
N, K = map(int, input().split())
A = []

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

B = set(A)
print(N - len(B))
N, K = list(map(int, input().split()))

d = list()
d = [d + list(input().split()) for i in range(K * 2)]
print(N - len(set(sum(d[1::2], []))))
N,K= list(map(int, input().split())) 

ans = [0]*(N+1)

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

res = len(ans)-1-sum(ans)
print(res)
n,k = map(int,input().split())
has = [False] * n

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

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

ass = 0
for i in range(n):
    if sum(ans[i]) == 0:
        ass += 1
        
print(ass)
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())))
  
A = list(itertools.chain.from_iterable(A))
A = list(set(A))
kotae = N - len(A)
print(kotae)
N,K=map(int,input().split(' '))
h = []
for i in range(K):
    d = int(input())
    l = list(map(int,input().split(' ')))
    for j in l:
        h.append(j)
print(N-len(list(set(h))))
N,K=map(int,input().split())
P= [list(map(int,input().split())) for i in range(2*K)]
count=0
Q=[]
for t in range(1,2*K,2):
    Q.append(P[t])

R=[]
for u in range(0,len(Q)):
    for s in range(0,len(Q[u])):
        R.append(Q[u][s])

for j in range(1,N+1):
    if j not in R:
        count=count+1
    else:
        count=count
print(count)
import sys
import math  # noqa
import bisect  # noqa
import queue  # noqa


def input():
    return sys.stdin.readline().rstrip()


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

    res = set()
    for _ in range(K):
        _ = int(input())
        A = list(map(int, input().split()))
        for a in A:
            res.add(a)

    ans = 0
    for i in range(1, N + 1):
        if i not in res:
            ans += 1
    print(ans)


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

A = [0]*N

for i in range(K):
  d = int(input())
  B = list(map(int, input().split()))
  for j in range(d):
    a = B[j]
    A[a-1] += 1
    
ans = 0
    
for i in range(N):
  if A[i] == 0:
    ans += 1
    
print(ans)
N, K = map(int, input().split())
S = [0] * N
for _ in range(K):
  n = int(input())
  for a in [int(x) for x in input().split()]:
    S[a - 1] += 1
print(sum([1 for s in S if s == 0]))
import math
from sys import stdin,stdout
#% 998244353
from heapq import heapify,heappop,heappush


# T = int(stdin.readline())
# for i in range(T):
    #N=int(stdin.readline())
N,K=list(map(int,stdin.readline().split()))
vis=set()
for k in range(K):
    dk=int(stdin.readline())
    ar=list(map(int,stdin.readline().split()))    
    for sn in ar:
        vis.add(sn)

print(N-len(vis))
N, K = list(map(int, input().split()))
treated = set()
for i in range(K):
    _ = input()
    
    treated = treated | (set(list(map(int, input().split()))))
print(len([x for x in range(N) if not x+1 in treated]))
n,k=map(int,input().split())
B=[0]*n
for _ in range(k):
    d=int(input())
    a=list(map(int,input().split()))
    for i in range(d):
        B[a[i]-1]+=1
print(B.count(0))
n, k = map(int, input().split())
A = [None]*k
for i in range(k):
    d = int(input())
    A[i] = list(map(int, input().split()))

snuke = [0] * n
for i in range(k):
    for j in A[i]:
        snuke[j - 1] += 1

ans = 0
for i in snuke:
    if i == 0:
        ans += 1
print(ans)
n,k = map(int,input().split())
ans = [False]*n
for i in range(k):
  b = int(input())
  A = list(map(int,input().split()))
  for a in A:
    ans[a-1] = True

print(n-sum(ans))
from collections import Counter
N, K = map(int, input().split())
xd=[]
for i in range(K):
    d = int(input())
    x = list(map(int, input().split()))
    xd.extend(x)

xd= Counter(xd)

print(N-len(xd))
n, k = [int(i) for i in input().split(" ")]
d = []
ans = [i for i in range(1, n + 1)]
for i in range(k):
    d.append(int(input()))
    A = [int(i) for i in input().split(" ")]
    for delete in A:
        if delete in ans:
            ans.remove(delete)
print(len(ans))
n,k = [int(x) for x in input().split(' ')]
 
def solve(n, k):
    snukes = [None] * n
    victims = 0
    
    for i in range(k):
        snacks = int(input())
        snukes_snacks = [int(z) for z in input().split(' ')]
        for j in range(snacks):
            snukes[snukes_snacks[j] - 1] = snukes_snacks[j]
    
    for w in range(n):
        if snukes[w] is None:
            victims += 1
    
    print(victims)
 
solve(n, k)
n, k = map(int, input().split())
a_set = set()
for _ in range(k):
    input()
    a = set(map(int, input().split()))
    a_set = a_set | a

n_set = set()
for i in range(1,n+1):
    n_set.add(i)

ans = n_set - a_set

print(len(ans))
n, k = map(int,input().split())
n_k = [0 for i in range(n)]
for i in range(k):
  _n = int(input())
  _k = list(map(int, input().split()))
  for i in _k:
    n_k[i-1] += 1

print(len([1 for i in n_k if i==0]))
n,k=map(int,input().split())
a=[]
for i in range(k):
    d=int(input())
    a+=list(map(int,input().split()))
a=set(a)
print(n-len(a))
n, k = [int(x) for x in input().split()]
l = []
for i in range(k):
    d = input()
    l.extend(list(map(int, input().split())))
s = set(l)
print(n -len(s))
N,K=map(int,input().split())
arr=[]
ans=[str(i) for  i in range(1,N+1)]
for i in range(K):
    _=input()
    arr.extend((input().split()))
    arr=list(set(arr))
p=0
for n  in  ans:
    if(not(n in arr) ) :
        p=p+1
print(p)
n,k = map(int,input().split())
ALL=[]
for i in range(k):
    d=int(input())
    A = list(map(int,input().split()))
    for ii in range(d):
        ALL.append(A[ii])
ans=list(set(list(range(1,n+1))) - set(ALL))
print(len(ans))
n, k = map(int, input().split())
sets = set()

for i in range(k):
    _ = input()
    sets |= set(map(int, input().split()))

m = set(range(1,n+1))
rest = m - sets
print(len(rest))
N,K = list(map(int,input().split()))
r = set()
for i in range(K):
  d = int(input())
  r |= set(map(int,input().split()))
print(N-len(r))
N,K = map(int,input().split())
cnt = [0]*(N+1)
for i in range(K):
    d = int(input())
    num = list(map(int,input().split()))
    for j in range(d):
        cnt[num[j]]+=1
print(cnt.count(0)-1)
N, K = map(int, input().split())
d = list()
have = list()

for i in range(K):
    d.append(int(input()))
    holders = list(map(int, input().split()))
    for holder in holders:
        if holder not in have:
            have.append(holder)
print(N - len(have))
N, K = map(int, input().split())
ans = [True]*N
for i in range(K):
  d = int(input())
  l = list(map(int, input().split()))
  for a in l:
    ans[a-1] = False
print(sum(ans))
N, K = input().split()

sunuke = []
for n in range(int(N)):
  sunuke.append([])
for k in range(int(K)):
  people = input()
  no = input().split()
  for i in no:
    sunuke[int(i)-1].append(int(K))
target = []
for i in range(int(N)):
  if len(sunuke[i]) == 0:
    target.append(i)
print(len(target))
N, K = map(int, input().split())
L = [0] * N
for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for j in A:
        L[j-1] += 1
print(len([i for i in L if i == 0]))
n,k=map(int, input().split())
l1=[]
for i in range(k):
    x=int(input())
    l=list(map(int, input().split()))
    for i in l:
        l1.append(i)
s=set(l1)
print(n-len(s))
# coding: utf-8

s = list(map(int, input().split(" ")))

snk = s[0]
oks = s[1]

v = []
for i in range(oks) :
    num = int(input())
    x = list(map(int, input().split(" ")))
    for j in range(num) :
        v.append(x[j])

ans = snk - len(set(v))

print(ans)
N, K = [int(i) for i in input().split()]
count = [0]*N

for _ in range(K):
  d = int(input())
  for v in input().split():
    j = int(v) - 1
    count[j] += 1
sunsuke = 0 
for i in count:
  if i == 0:
    sunsuke += 1
print(sunsuke)
if __name__ == "__main__":
    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:
            if j not in s:
                s.add(j)
    
    ans = n - len(s)
    print(ans)
N, K = map(int,input().split())
sunuke_dict = dict()

for _ in range(K):
    d = input()
    s_list = input().split()

    for s_id in s_list:
        if s_id not in sunuke_dict:
            sunuke_dict[s_id] = [d]
        else:
            sunuke_dict[s_id].append(d)

print(N - len(sunuke_dict))
N, K = map(int, input().split())
A = [None] * K
for i in range(K):
    d = int(input())
    A[i] = list(map(int, input().split()))

flat_list = [s for a in A for s in a]
set_a = set(flat_list)
ans = 0

for i in range(1, N + 1):
    if not i in set_a:
        ans += 1

print(ans)
n,k = map(int, input().split())
hito = []
for i in range(k):
  d = int(input())
  x = list(map(int, input().split()))
  for j in range(d):
    hito.append(x[j])
a = list(set(hito))
ans = n
for i in range(n):
  if i+1 in a:
    ans -= 1
print(ans)
n, k = map(int, input().split())

n_l = [1]*n

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

print(sum(n_l))