peterverebics/CodeNet_Python_118 huggingface dataset:
def main():
    N, K = list(map(int, input().split()))

    haved = [0] * N
    ans = 0
    for i in range(1, K+1, 1):
        d = int(input())
        ai = list(map(int, input().split()))
        for j in range(0, d, 1):
            x = ai[j] - 1
            haved[x] = haved[x] + 1

    for i in range(0, N, 1):
        if haved[i] == 0:
            ans = ans+1

    print(ans)


if __name__ == '__main__':
    main()
n,k=map(int,input().split())
count=[0]*n
for i in range(k):
    d=int(input())
    a=list(map(int,input().split()))
    for j in range(d):
        count[a[j]-1]+=1
ans=0
for i in range(n):
    if count[i]==0:
        ans+=1
print(ans)
n,k=map(int,input().split())
record=[]
for i in range(k):
    d=input()
    record.extend(list(map(int,input().split())))
record=list(set(record))
print(n-len(record))
n, k = map(int, input().split())

a = []

for i in range(k):
    d = int(input())
    temp = [k for k in map(int, input().split())]
    for j in range(d):
        a.append(temp[j])



a = set(a)

print(len(set(range(1,n+1)) - a))
def io():
    return map(int,input().split())
def op():
    return list(map(int,input().split()))
n,k=io()
s=set()
c=0
for _ in range(k):
    d=int(input())
    s.update(op())
for i in range(1,n+1):
    if i not in s:
        c+=1
print(c)
n, k = map(int, input().split())
sunuke = [0] * n
for _ in range(k):
    d = int(input())
    a_li = list(map(int, input().split()))
    for a in a_li:
        sunuke[a - 1] += 1
print(sunuke.count(0))
import sys
import math
import fractions
from collections import deque
from collections import defaultdict
sys.setrecursionlimit(10**7)

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

cnt = 0
for s in snuke:
    if s == 0:
        cnt += 1

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

m = [0]*n

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

print(m.count(0))
N,K=map(int,input().split())
B=list()
for i in range(K):
    d=int(input())
    A=list(map(int,input().split()))
    B.extend(A)
B=set(B)
print(N-len(B))
n, k = map(int, input().split())

d = []
a = []

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


okashi = [0] * n


for i in a:
    for j in i:
        okashi[j-1] = 1

ans = n - sum(okashi)

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

for i in range(k):
    d=int(input())
    a=list(map(int,input().split()))
    for j in a:
        if j in n:
            n.remove(j)
    
print(len(n))
n,k = map(int,input().split())
l = [0]*n
for _ in range(k):
    d = int(input())
    a = list(map(int,input().split()))
    for i in a:
        l[i-1] = 1
print(l.count(0))
N, K = [int(i) for i in input().split()]
A = []
for i in range(K):
    input()
    A += [int(i) for i in input().split()]
print(N - len(set(A)))
N,K = map( int ,input().split())
N_list = [0]*N
for i in range(K):
    d = int(input())
    num_list = [int(i) for i in input().split()]
    for j in range(len(num_list)):
        N_list[num_list[j]-1] +=1
print(N_list.count(0))
N, K = map(int, input().split())
result = [0] * N

for k in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for a in A:
        result[a-1] = 1
    A.clear()

print(result.count(0))
n, k = map(int, input().split())
arr = [False for i in range(n + 1)]
count = 0
for i in range(k):
    d = int(input())
    darr = list(map(int, input().split()))
    for j in darr:
        arr[j] = True
for i in range(len(arr)):
    if arr[i] == False:
        count+=1
print(count - 1)
N,K=map(int,input().split())
d=[]
A=[]
for _ in range(K):
    d.append(int(input()))
    A.append(list(map(int,input().split())))
cnt=[0 for i in range(N)]
for i in range(K):
    for a in A[i]:
        cnt[a-1]+=1
print(cnt.count(0))
def main():
    N,K=map(int,input().split())
    ans=[i for i in range(1,N+1)]
    for _ in range(K):
        d = int(input())
        A=[int(_) for _ in input().split()]
        for a in A:
            if a in ans:
                ans.remove(a)
    print(len(ans))

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

xs = [0] * N
for rs in A:
    for r in rs:
        xs[r - 1] += 1

result = sum(x == 0 for x in xs)

print(result)
n,k = map(int,input().split())
s = []
for i in range(k):
    d = int(input())
    a = list(map(int,input().split()))
    for j in range(d):
        s.append(a[j])
s = set(s)
print(n-len(s))
N,K=map(int,input().split())
hoge=[0 for j in range(N)]
for j in range(K):
    input()
    for i in input().split():
        hoge[int(i)-1]+=1
print(sum([j==0 for j in hoge]))
def main():
    n,k = map(int,input().split(" "))
    l =[True]*n
    for i in range(k):
        d = int(input())
        As = list(map(int,input().split(" ")))
        for A in As:
            l[A-1] = False
    
    print(l.count(True))
main()
n,k=[int(i) for i in input().split()]
a=[0]*n

for i in range(k):
    d=int(input())
    motteru=[int(i) for i in input().split()]
    for j in motteru:
        a[j-1]+=1
print(a.count(0))
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] - 1] += 1
    
print(A.count(0))
n, k = map(int, input().split())
d = [0]*k
a = [0]*k

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

ans = [0]*100

for i in range(k):
    for j in range(d[i]):
        ans[a[i][j]-1] = 1

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

sunukes = set()

for i in range(k):
    d = int(input())
    li = input().split()
    for j in range(d):
        sunukes.add(li[j])

print(n - len(sunukes))
#!/usr/bin/env python3
import numpy as np

n, k = map(int, input().split())
f = np.zeros(n)
for i in range(k):
    d = int(input())
    a = map(int, input().split())
    for ai in a:
        f[ai-1] += 1
print(np.count_nonzero(f==0))
N, K = map(int, input().split())

sunukes = [0]*N

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

    for l in lis:
        sunukes[l-1] += 1

ans = 0
for s in sunukes:
    if s == 0:
        ans += 1

print(ans)
N,K=map(int,input().split())
mylist=[]
for _ in range(K):
  d=int(input())
  A=list(map(int,input().split()))
  for _ in range(d):
    mylist=list(set(mylist+(A)))
print(N-len(mylist))
import sys
input=sys.stdin.readline

N,K=(int(x) for x in input().rstrip('\n').split())
snuke=set()
for i in range(K):
  d = int(input().rstrip('\n'))
  snuke = snuke | set((int(x) for x in input().rstrip('\n').split()))
print(N-len(snuke))
n, k = [int(i) for i in input().split()]
sunuke = [0] * n
for i in range(k):
  _ = int(input())
  for j in input().split():
    sunuke[int(j)-1] += 1
print(sunuke.count(0))
nk = list(map(int, input().split()))
n = nk[0]
k = nk[1]
a = []
ans = 0
for i in range(k):
  d = input()
  a.extend(list(map(int, input().split())))
for j in range(1, n + 1):
  if not j in a:
    ans = ans + 1
print(ans)
n,m=map(int,input().split( ))
p=[i for i in range(1,n+1)]
for i in range(m):
    d=int(input())
    q=list(map(int,input().split( )))
    for j in q:
        if j in p:
            p.remove(j)
print(len(p))
N,K = map(int,input().split())

sunuke = []
ans = 0

for i in range(N):
    sunuke.append([])

for i in range(1,K+1):
    input()
    for j in map(int,input().split()):
        sunuke[j-1].append(i)

for i in sunuke:
    if len(i) == 0:
        ans += 1

print(ans)
N, K = map(int,input().split())
A = []
for i in range(K):
    d = int(input())
    A.append(input().split())
A = sum(A,[])
res = N - len(set(A))
print(res)
N, K = map(int, input().split())


s= set()

for _ in range(K):
    d = int(input())
    A = map(int, input().split())
    b = set(A)
    s = s | b
    
print(N -len(s))
N,M=map(int,input().split())
i = 0
B_list = []
for i in range(M):
    d = int(input()) # nは入力回数
    A = list(map(int,input().split()))
    B_list = B_list + A
C = N - len(set(B_list))
print(C)
n,k = map(int,input().split())

have_treat = list()

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

print(n-len(set(have_treat)))
n, k = map(int, input().split())
s = set(range(1, n + 1))
for d in range(k):
    snack = int(input())
    aa = map(int, input().split())
    for a in aa:
        if a in s:
            s.remove(a)

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

l=set()

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

print(n-len(l))
def main():
    nk = list(map(int, input().split()))
    s = [0]*nk[0]
    for i in range(nk[1]):
        d = int(input())
        a = list(map(int, input().split()))
        for j in a:
            s[j-1] += 1
    print(s.count(0))

if __name__ == '__main__':
    main()
#!python3

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


def main():
    s = {i for i in range(1, N + 1)}
    for l in A:
        for a in l:
            if a in s:
                s.remove(a)

    ans = len(s)
    print(ans)


if __name__ == "__main__":
    main()
n,k=list(map(int,input().split()))
ans=[0]*105
c=0
for i in range(k):
    d=int(input())
    a=list(map(int,input().split()))
    for j in range(len(a)):
        ans[a[j]-1]=ans[a[j]-1]+1
for i in range(n):
    if ans[i]==0:
        c=c+1
print(c)
from collections import defaultdict, Counter, namedtuple, deque
import itertools
import functools
import bisect
import heapq
import math


NN = 202020
MOD = 10**9+7
# MOD = 998244353
INF = float("inf")

n, k = map(int, input().split())
kashi = [True]*n
for i in range(k):
    d = int(input())
    A = list(map(int, input().split()))
    for j in A:
        kashi[j-1] = False

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

print(y.count(0))
import sys
input = sys.stdin.readline

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

    ans = 0
    for i in A:
        if i == 0:
            ans += 1

    print(ans)

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

cnt = [0 for i in range(n)]
for i in range(k):
    d  = int(input())
    A  = list(map(int, input().split()))
    
    # print("A:", A)
    for j in A:
        # print(cnt)
        cnt[j-1] += 1

ans = 0
for p in cnt:
    if p == 0:
        ans += 1

print(ans)
nk = input().split()
NK =[int(x) for x in nk]
t = []
s = []
for i in range(1 ,NK[0]+1):
	s.append(i)
for i in range(1,NK[1]+1):
    d = int(input())
    A =  input().split()
    a = [int(x) for x in A]
    t += a
set_t = set(t)
set_s = set(s)
r = set_s - set_t
print(len(r))
n,k=map(int,input().split())
d = []
a_list = []
for i in range(k):
    d.append(int(input()))
    a_list.append(list(map(int,input().split())))

sunu = [1 for i in range(n)]
for i in range(k):
    for a in a_list[i]:
        sunu[a-1] = 0
print(sum(sunu))
n, k = map(int, input().split())

all_snucks = set(i for i in range(1, n + 1))

for snack in range(1, k + 1):
    d = int(input())
    snucks = map(int, input().split())

    for snuck in snucks:
        if snuck in all_snucks:
            all_snucks.remove(snuck)

print(len(all_snucks))
N, K = map(int, input().split())
sunuke = [False]*N
for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for a in A:
        sunuke[a-1] = True
ans = sunuke.count(False)
print(ans)
from sys import stdin
input=lambda : stdin.readline().strip()
from math import ceil,sqrt,factorial,gcd
n,k=map(int,input().split())
s=set()
for i in range(k):
	a=int(input())
	l=list(map(int,input().split()))
	for j in  l:
		s.add(j)
print(n-len(s))
n,k=map(int,input().split())
h=[]
for _ in range(k):
    d=int(input())
    as_=list(map(int,input().split()))
    for a in as_:
        h.append(a)
ans=0
for m in range(1, n+1):
    if not m in h:
        ans+=1
print(ans)
i = list(map(int, input().split()))
a=[]
c=[]
for j in range(i[0]):
    a.append(0)
for j in range(i[1]):
    b=int(input())
    c=list(map(int, input().split()))
    for k in range(b):
        a[c[k]-1]=1
print(a.count(0))
n,k = map(int, input().split())
L = [list(map(int, input().split())) for i in range(2*k)]
A = []
for i in range(k):
  A = A + L[2*i + 1]
ans = 0
for i in range(n):
  if i+1 not in A:
    ans += 1
    
print(ans)
N,K=map(int,input().split())
who_have=[]
while(K!=0):
    k=int(input())
    someone_have=list(map(int,input().split()))
    if(len(someone_have)!=0):
        for i in someone_have:
            if(i in range(1,N+1)):
                who_have.append(i)
    K-=1
print(N-len(set(who_have)))
import sys
#sys.exit()
#sorted( ,reverse=True)
#N = int(input())
N,K = map(int, input().split())
A = []
for i in range(K):
    d = int(input())
    B = list(map(int, input().split()))
        
    A += B 
   #print(B)
   #print(A)    

#A = [int(input()) for _ in range(N)]

cnt = N
for i in range(1,N+1):
    if i in A:
        cnt -= 1



#print(N)
#print(S,T)
#print(A)
#print('Yes')
#print('No')
print(cnt)
N, K = map(int, input().split())
ans = [0]*N
for i in range(K):
    d = int(input())
    for j in list(map(int, input().split())):
        ans[j-1] = 1
print(ans.count(0))
n,k = map(int,input().split())

judge = [True] * n
for i in range(k):
    j = int(input())
    A = list(map(int,input().split()))
    for a in A:
        judge[a-1] = False

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

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

for i in range(0,k):
    a = int(input())
    if a == 1:
        b = int(input())
        if b in member:
            member.remove(b)
        else:
            pass
    else:
        b = list(map(int, input().split()))
        for j in range(0,a):
            if b[j] in member:
                member.remove(b[j])
            else:
                pass

print(len(member))
n,m=map(int,input().split())
d=[list(map(int, input().split())) for i in range(m*2)]

s=[]
for i in range(1,m*2,2):
  s.extend(d[i])
s=list(set(s))

print(n-len(s))
import sys
input = sys.stdin.readline

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

items = []

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

print(N - len(set(items)))
import collections
N, K = map(int, input().split())
a = set()
for i in range(K):
    d = input()
    a |= set(map(int, input().split()))
print(N - len(a))
# -*- coding: utf-8 -*-
# 標準入力の取得
N, K = list(map(int, input().split()))
d = []
A = []
for k in range(K):
    d.append(int(input()))
    A.append(list(map(int, input().split())))

# 求解処理
persons = set()
for A_i in A:
    for A_ij in A_i:
        persons.add(A_ij)

result = N - len(persons)

# 結果出力
print(result)
N, K = map(int, input().split())

num_list = []
d = []
for i in range(N):
  try:
      d.append(list(map(int,input().split())))
      num_list.append(list(map(int,input().split())))
  except EOFError:
    pass
  
#those who has snack
snack = set(sum(num_list, []))

ppl = []
for i in range(N):
    ppl.append(N)
    N -= 1
    
nsnack = set(ppl) - snack
nosnack = list(nsnack)

print(len(nosnack))
n, k = map(int, input().split())
b = set()
for i in range(k):
    a = int(input())
    b |= set(map(int, input().split()))
print(n - len(b))
def main():
    N, K = (int(_) for _ in input().split())
    snuke = set(range(1, N+1))
    okashi = []
    for _ in range(K):
        d = int(input())
        okashi += [int(_) for _ in input().split()]
    snuke = snuke - set(okashi)
    print(len(snuke))
    return



if __name__ == '__main__':
    main()
N,K = map(int,input().split(" "))
l = list(range(1,N+1))
for i in range(K):
  d = int(input())
  s = input().split(" ")
  for j in s:
    if int(j) in l:
      l.remove(int(j))
print(len(l))
n,k = map(int, input().split())

s = {i:0 for i in range(n+1)} 

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

cnt = -1

for i in s:
  if s[i] == 0:
    cnt +=1

print(cnt)
N, K = map(int, input().split())
user_have_sweets = []
for i in range(K):
    __sweets_number = input()
    li = list(map(int, input().split()))
    user_have_sweets.extend(li)

counta = 0
for i in range(1, N+1):
    if i in user_have_sweets:
        pass
    else:
        counta += 1

print(counta)
a,b = map(int,input().split(" "))
ar = [0 for i in range(a)]
for i in range(b):
    j = int(input())
    br = list(map(int,input().split(" ")))
    for r in br:
        ar[r-1] += 1
print(ar.count(0))
import numpy as np
n,k = map(int, input().split())
n_n = np.zeros(n+1) 
for i in range(k):
    d = input()
    a = map(int, input().split())
    for j in a:
        n_n[j] += 1
print(list(n_n).count(0)-1)
# B

inp = input().split(' ')
N, K = int(inp[0]), int(inp[1])

sunuke = [1] * N

for i in range(K):
    di = int(input())
    tmp = map(int, input().split())
    for t in tmp:
        sunuke[t-1] = 0
print(sum(sunuke))
n,k = map(int,raw_input().split(' '))
h = set([])
for _ in range(k):
	di = int(raw_input())
	for ii in map(int, raw_input().split(' ')):
		h.add(ii)
print n - len(h)
n,k=map(int,input().split())
i=0
d=[]
a=[]
while i<k:
    d.append(int(input()))
    a.extend(list(map(int,input().split())))
    i+=1
i=1
count=0
while True:
    if((i in a)!=True):
        count+=1
    i+=1
    if(i>n):
        break

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

list = []
for i in range(1,n+1):
    list.append(i)
for risu in num_list:
    for x in risu:
        if x in list:
            list.remove(x)
tuple = tuple(list)


print(len(tuple))
n,k=map(int,input().split())
ml=[int(i) for i in range(1,n+1)]
while k>0:
    mm=int(input())
    ll=list(map(int,input().split()))
    result=list(set(ml)-set(ll))
    ml=result
    k-=1
print(len(ml))
N,K = map(int, input().split())
arr1=[]
arr=[]
for i in range(1, N+1):
  arr1.append(i)

for i in range(K*2):
  A=list(map(int, input().split()))
  if i%2!=0:
    arr = arr+A
print(len(list(set(arr1) - set(arr))))
a = list(map(int, input().split()))
b = list(range(a[0]+1))
d = []
A = []

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

B = set(A)
print(a[0]-len(B))
n, k = [int(i) for i in input().split()]
cnt = n
cnt_ = [0] * n
for _ in range(k):
  d = int(input())
  a = [int(i) for i in input().split()]
  for j in a:
    if cnt_[j - 1] == 0:
      cnt -= 1
      cnt_[j - 1] = 1
print(cnt)
N, K = map(int, input().split())
flag = [True]*N
for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for a in A:
        flag[a-1] = False
ans = 0
for i in range(N):
    if flag[i]:
        ans += 1
print(ans)
from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")


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


if __name__ == '__main__':
    main()
n, k = map(int, input().split())
l_n = [0] * n
for i in range(0, k):
    d = int(input())
    a = map(int, input().split())
    for l in a:
        l_n[l-1] = 1
print(l_n.count(0))
N, K = map(int, input().split())
S = []

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

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

s = set()
for i in range(k):
  d = input()
  a = map(int, input().split())
  for x in a:
    s.add(x)
    
print(n-len(s))
N, K = map(int, input().split())
d = []
A = []
for k in range(K):
    d.append(int(input()))
    A += list(map(int, input().split()))

print(N - len(set(A)))
import itertools
n, k = map(int,input().split())
d = []
a = []


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

a = list(itertools.chain.from_iterable(a))
a = list(set(a))

print(n - len(a))
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()))
    for i in a:
        if i in l:
            l.remove(i)
print(len(l))
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])

for i in range(n):
  if i+1 not in ans:
    count += 1
  
print(count)
N, K = map(int, input().split())

ls = set()

for k in range(K):
    d = input()
    A = list(map(int, input().split()))
    for a in A:
        ls.add(a)

print(N - len(ls))
N,K = map(int,input().split())
data = [1]*N
for k in range(K):
    input()
    num = list(map(int,input().split()))
    for i in num[:]:
        data[i-1] = 0
print(sum(data))
N,K = map(int,input().split())

O = [0]*N

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

s=[0]*n

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

print(s.count(0))
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 A:
        B[j-1] += 1

print(B.count(0))
n, k = map(int,input().split())
d = [0]*n
for i in range(k):
    a = int(input())
    li = list(map(int,input().split()))
    for num in li:
        d[num-1] = 1

print(d.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())))
counter = [0] * N
for i in range(K):
    for j in range(d[i]):
        counter[A[i][j] - 1] += 1
ans = 0
for a in counter:
    if a == 0:
        ans += 1
print(ans)
N, K = map(int, input().split())

done = set([])
for _ in range(K) :
  d = int(input())
  A = [int(i) for i in input().split()]
  done |= set(A)
  
print(N - len(done))
n,k=map(int,input().split())
have=[False]*n
for i in range(k):
    d=int(input())
    a=list(map(int,input().split()))
    for j in a:
        have[j-1]=True
print(have.count(False))
N, K = map(int,input().split())
l=list(range(1,N+1))
for i in range(K):
  d=int(input())
  s = input().split()
  for j in range(d):
    l[int(s[j])-1]=0
num=0
for i in range(N):
  if l[i]!=0:
    num=num+1
print(num)
import sys

N,K = map(int,input().split())
array = [ a for a in range(1,N+1) ]

for I in range(K):
    _ = input()
    sweets = list(map(int,input().split()))
    for K in sweets:
        if K in array:
            array.remove(K)
print(len(array))
n,k = map(int,input().split())

l = []
for _ in range(k):
  d = int(input())
  a = list(map(int,input().split()))
  l.extend(a)
  l = list(set(l))

print(n - len(l))
NK = input().split()
S = set()

N = int(NK[0])
K = int(NK[1])

for i in range(K):
    n = int(input())
    L = input().split()

    for x in L:
        if x in S:
            pass
        else:
            S.add(x)

print(N - len(S))
n,k = map(int,input().split())
s = set()
for i in range(k):
    d = int(input())
    l = list(map(int,input().split()))
    for i in l:
        s.add(i)
print(n-len(s))