peterverebics/CodeNet_Python_118 huggingface dataset:
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n,k = iim()
l = [True]*n
for i in range(k):
    d = ii()
    A = iil()
    for item in A:
        if l[item-1] == True:
            l[item-1] = False

print(l.count(True))
n,k=map(int,input().split())
l=[]
for i  in range(n):
    l.append(i+1)
for i in range(k):
    d=int(input())
    a=list(map(int,input().split()))
    for z in a:
        if z in l:
            l.remove(z)
print(len(l))
#!/usr/bin/env python3
n, k = map(int, input().split())
a = []
for i in range(k):
    d = int(input())
    a += list(map(int, input().split()))
print(n - len(set(a)))
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_set = set(a[0])
for i in a:
    a_set = a_set | set(i)

ans = set((range(1, N+1))) - a_set
print(len(ans))
N,K = list(map(int,input().split()))

flag = [1]*N

for i in range(K):
    d = int(input())
    A = list(map(int,input().split()))
    for a in A:
        flag[a-1] = 0

print(sum(flag))
a,b=input().split()
c=int(a)
d=int(b)
e=[]
for i in range(c):
    e.append(i+1)
for j in range(d):
    f=int(input())
    g=input().split()
    h=[int(s) for s in g]
    for n in range(len(h)):
        if h[n] in e:
            e.remove(h[n])
print(len(e))
n, k = map(int, input().split())
l = [0 for _ in range(n)]
ans = 0

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

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

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

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

print(ct)
N, K = map(int, input().split())
used = [False]*(N+1)
for _ in range(K):
    _ = int(input())
    for i in map(int, input().split()):
        used[i] = True
print(N-sum(used))
(N, K) = tuple([int(s) for s in input().split()])
d = {i: 0 for i in range(1, N + 1)}
for _ in range(K):
    n = int(input())
    A = [int(s) for s in input().split()]
    for a in A:
        d[a] += 1
print(len([i for i in d if d[i] == 0]))
import sys
def input(): return sys.stdin.readline().rstrip()
from collections import Counter
def main():
    n,k=map(int,input().split())
    A=[0]*n
    for i in range(k):
        _=int(input())
        a=[int(_) for _ in input().split()]
        for aa in a:
            A[aa-1]+=1
    ac=Counter(A)
    print(ac[0])

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

nums = [ ]
for _ in range(K):
    _ =  int(input())
    nums.extend([int(x.strip()) for x in input().split(' ') ])

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

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

cnt = 0                    
for q in N:
    if q != 0:
        cnt += 1
print(cnt)
have_person = set()
N, K = map(int, input().split())
for _ in range(K):
    _ = input()
    have_person |= set(list(map(int, input().split())))
print(N - len(have_person))
NK = list(map(int, input().split()))
N=NK[0]
K=NK[1]
sunukes = [i+1 for i in range(N)]
for i in range(K):
  d = int(input())
  A = map(int, input().split())
  for a in A:
    if a in sunukes:
      sunukes.remove(a)

print(len(sunukes))
n, k = map(int, input().split())
lista = set()
for i in range(k):
    d = int(input())
    a = set(list(map(int, input().split())))
    lista = lista | a
print(n - len(lista))
n, k = map(int, input().split())
ans = [int(x) for x in range(1, n+1)]
for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for j in a:
        if j in ans:
            ans.remove(j)
print(len(ans))
Sunuke=[]

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

    Sunuke.extend(A)

print(N-(len(set(Sunuke))))
import logging

logging.basicConfig(level=logging.INFO, format="%(message)s")
#logging.disable(logging.CRITICAL)

def main():
    N, K = map(int, input().split())
    N_list = [1 for x in range(N)]
    s_list = [x for x in range(1, N)] 
    
    for i in range(K):
        di = int(input())
        A_i = list(map(int, input().split()))
        for j in A_i:
            N_list[j - 1] = 0

    print(N_list.count(1))
    
if __name__ == "__main__":
    main()
n,k=map(int,input().split())
s=[]
for i in range(k):
  d=int(input())
  a=list(map(int,input().split()))
  s.extend(a)
t=list(set(s))
print(n-len(t))
import numpy as np
N, K = map(int, input().split())
member = np.ones(N, dtype=int)
for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for j in range(len(A)):
        member[A[j]-1] = 0
print(sum(member))
n,k=map(int,input().split())
list_1=[]
for _ in range(n):
    list_1.append(0)
#print(list_1)

for i in range (k):
    d=int(input())
    list_temp=list(map(int,input().split()))
    for j in list_temp:
        list_1[j-1]+=1
#print(list_1)

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

snuke = [0 for i in range(n)]

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

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

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

for i in range(1, k*2+1):
  if i%2==1:
    pass
  else:
    for s_i in map(int, input().split()):
      ss.add(s_i)
print(len([s for s in range(1, n+1) if s not in ss]))
NK=input().split()
N=int(NK[0])
K=int(NK[1])
listd=[]
listA=[]
for i in range(K):
    listd.append(input())
    listA.append(input().split())
ans=0
for a in range(1,N+1):
    n=0
    for i in range(1,K+1):
        for j in range(1,int(listd[i-1])+1):
            if a==listA[i-1][j-1]:
                n+=1
            else:
                pass
    if n==0:
        ans+=1
print(ans)
N, K = map(int, input().split())
A=[]
i=0
m=0
for _ in range(2*K):
    a = [int(x) for x in input().split()]
    if i%2!=0:
        A.append(a)
    i=i+1
A = list(map(list, set(map(tuple, A))))
print(N-len(A))
N,K = map(int, input().split())
d = []
n = []
for k in range(K):
    d.append(input())
    n.append(input().split())
def flatten(nested_list):
    return [e for inner_list in nested_list for e in inner_list]
nfu = set(flatten(n))
print(nfu)
print(N - len(nfu))
whatMan = []

N, K = input().split()
for i in range(int(K)):
    print(input().split())
N,K = map(int,input().split())

print(N - int(input()))
n, k = [int(x) for x in input().split()]
d = {}
for _ in range(k):
    d.setdefault(input(), list(map(int, input().split())))
l = []
for _ in d.values():
    l.extend(_)
s = set(l)
print(n - len(s))
n,k = map(int,input().split())
d = []
e = []
for i in range(k):
    d.append(input())
    e.append(input())
f = list(set(e))
g = len(f)
print(n-g)
N, K = map(int, input().split())
data = set(range(N + 1))
data = data - {0}
data_remove = set()
for i in range(K):
    n = int(input())
    data_n = set(input().split())
    data_remove = data_remove | data_n
print(len(data - data_remove))
N, K = map(int, input().split())
ANSlist = [1]*(N)

for i in range(K):
    I = input() #
    S = list(input())
    for j in range(len(S)):
        if S[j] != " ":
            ANSlist[int(S[j])-1] = 0

ANS = 0

for i in range(len(ANSlist)):
    if ANSlist[i] != 0:
        ANS += 1

print(ANS)
import sys
import math
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

n,k = I2()
l = []
for i in range(k):
    d = I()
    for k in intl():
        l.append(k)
print(len(l)-len(list(set(l))))
n, k = map(int, input().split())

a = []

s = 0
for i in range(k):
  d = int(input())
  array = list(map(int, input().strip().split()))
  a.append(array)
for j in range(1, n):
  if k not in a:
    s += 1
print(s)
n,k=map(int,input().split())
l=[]
count=0
for _ in range(k):
    d=int(input())
    a=list(map(int,input().split()))
    l+=a
for i in range(1,n+1):
    if i in l:
        count+=1
print(count)
n, m = map(int, input().split())
ql = [tuple(map(int, input().split())) for i in range(2*m)]
a = ql[1::2]
print(n - len(set(a)))
try:
  n,k=map(int,input().split())
  count=0
  l,p=[],[]
  for i in range(k):
      d=int(input())
      a=list(map(int,input().split()))
      for i in range(1,n+1):
          if i not in a:
              l.append(i)
  for i in l:
      if l.count(i)>1:
          if i not in p:
              p.append(i)
  print(len(p))
except:
  pass
N, K = map(int, input().split())
d = []
A = []

s = set([i for i in range(1, N+1)])
print(s)
rs = set()

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

for i in range(K):
    for a in A:
        for j in a:
            rs.add(j)

for i in rs:
    s.remove(i)

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

okashi = set(list(range(1, n)))

for i in range(k):
    d = int(input())
    A = set(map(int, input().split()))
    okashi = okashi - A 
print(len(okashi))
N, K = map(int, input().split())

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

print(N - max_n)
N, K = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(2 * K)]

treated = (list(range(1, N+1)))

for i in range(int((K+1)/2)):
  tt = list(set(list(range(1, N+1))) - set(l[2*i+1]))
  print(tt)
  treated = list(set(treated) & set(tt))

print(len(treated))
N,K = map(int,input().split())
sunuke_dict = {}
for i in range(K):
    d = int(input())
    sunuke_dict[d] = list(map(int,input().split()))
ans = [1]*(N+1)
ans[0]  =0
for v in sunuke_dict.values():
    for v_ in v:
        if ans[v_] == 1:
            ans[v_] =0
print(sum(ans))
import numpy as np

N,K=(int(x) for x in input().split())

A=[]
l=[]
for i in range(K):
    #d = int(input(''))
    #for j in range(d):
        #l_ = int(input(''))
        #l.append(l_)
    l=[int(x) for x in input().split()]
    A.append(l)

a=np.zeros((N, K))
for i in range (len(A)):
    for j in range(len(A[i])):
        a[A[i][j]-1][i]=1
#print(a)

print(np.count_nonzero(np.all(a==0, axis=1)))
N,K=map(int,input().split())
a=[list(map(int,input().split()))for i in range(2*K)]
sunuke=[]
for i in range(2*K):
    if i%2==1:
        d=sum(a[i-1])
        for n in range(d):
            sunuke.append(a[i][n])
print(sunuke)
sunuke=set(sunuke)
print(N-len(sunuke))
n,k = map(int,input().split())
import itertools

grid = []
for i in range(2*k):
    array = list(map(int, input().strip().split()))
    grid.append(array)
print(grid)
l = []
for j in range (k):
    l.append(grid[0+2*j+1])
print(l)
lis = list(itertools.chain.from_iterable(l))
print(lis)
count = 0
for m in range(n):
    if m+1 in lis:
        count = count +1
print(n - count)
[N, K] = list(map(int, input().split()))
dList = []
AList = []
snuckSnack = {}
for i in range(K):
    dList.append(int(input()))
    AList.append(list(map(int, input().split())))
for i in range(1,N+1):
    snuckSnack[i] = 0
for i in dList:
    snuckSnack[i] = 1
vicCount = 0
for i in range(1,N+1):
    if snuckSnack[i] == 0:
        vicCount += 1
print(vicCount)
import collections
N,K=map(int,input().split())
a=[]
while K>0:
  K=K-1
  d=int(input())
  a.append(map(str,input().split()))
e=collections.Counter(a)
p=N-len(e)
print(p)
n,k = list(map(int,input().strip().split()))
temp = []
ans = int(0)
for i in range(k):
    d = int(input())
    li = list(map(int,input().split()))
    for j in range(d):
        temp += str(li[j])
for m in range(n):
    b  = str(m + 1)
    a = temp.count(b)
    if a == 0:
        ans += 1
print(ans)
N, K = map(int,input().split())
S = set() #Sがお菓子を持っている人
P = list(range(1,N+1,1))
for i in range(K):
  D = int(input())
  A = list(map(int, input().split()))
  for a in A:
    S.add(a)
print(set(P) - S)
a = input().split()

n = int(a[0])
k = int(a[1])

d = input()
d = int(d)

print(n-d)
n,k = map(int,input().split())
import itertools

grid = []
for i in range(2*k):
    array = list(map(int, input().strip().split()))
    grid.append(array)
print(grid)
l = []
for j in range (k):
    l.append(grid[0+2*j+1])
print(l)
lis = itertools.chain.from_iterable(l)
print(list(itertools.chain.from_iterable(l)))
count = 0
for m in range(n):
    if m+1 in lis:
        count = count +1
print(n - count - 1)
n,k = map(int,input().split())
d = int(input())
print(n-d)
N,K = map(int,input().split())
c = 0
listA = []
for k in range(1,K+1):
    d = int(input())
    listA += list(map(int,input().split()))
    
for n in range(1,N+1):
    if n in listA:
        c += 1
print(c)
[N, K] = list(map(int, input().split()))
all_A =[]
for i in range(1, N + 1):
    all_A.append(i)
for j in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    after_A = set(all_A) ^ set(A)
print(len(after_A))
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(n in arr)   :
        p=p+1
print(p)
def main():
  s = list(map(int,input().split()))
  n = [0]*s[0]
  for k in range(1,s[1],1):
    d = int(input())
    a = list(map(int,input().split()))
    #print(a)
    for i in range(0,d,1):
      #print(a[i])
      n[a[i]-1] = 1
      #print(n)
      
  sum=0
  #print(n)
  
  for k in range(0,s[0],1):  
    if(n[k]==0): sum = sum+1
 
  print(sum)
  
main()
N, K =map(int, input().split())
snuke = [0]*N

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

print(snuke.count(0))
N,K = map(int,input().split())

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

print(ans)
N,K = map(int,input().split())
s = [input() for i in range(K*2)]
l = []
c = 0
k = 0
m = 0
# スペース区切りの整数の入力
num = []
for i in range(K*2):
  if i%2==1:
    for m in range(int(s[i-1])):
      num.append(s[i].split()[m])
for j in (1,N):
  k=num.count(str(j))
  if k == 0:
    c = c+1
print(c)
n,k = map(int,input().split())
d = int(input())
if d < n:
  print(n-d)
else:
  print(0)
N, K = map(int, input().split())
numlist = []
for i in range(K*2):
    numlist.append(list(map(int,input().split())))
anslist=[]

i=0
while i<K*2:
    if not i%2==0:
        anslist.append(numlist[i])
    i+=1

checklist=str(anslist)
ans=0
j=1
while j<N+1:
    check=j
    if str(check) not in checklist:
        ans+=1
    j+=1
    
print(ans)
n, k = map(int, input().split())
a = []
d = []
for i in range(k):
    d.append(int(input()))
    a.extend(list(map(int, input().split())))

n_set = {i for i in range(1, n)}

a_set = set(a)

difference = n_set - a_set

print(len(difference))
s=input()
l=list(map(int,s.split()))
n=l[0]
k=l[1]

ss=set([i+1 for i in range(n)])
work=l[2:]
counter=set([])

i=0
while True:
    if i==len(work):
        break
    for j in work[i+1:i+work[i]+1]:
        counter.add(j)
        print(counter)
        
    i=i+work[i]+1
    
for j in list(counter):
    ss.remove(j)
print(len(ss))
N, K = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(2 * K)]

treated = (list(range(1, N)))

for i in range(int((K+1)/2)):
  tt = list(set(list(range(1, N))) - set(l[2*i+1]))
  treated = list(set(treated) & set(tt))

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

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

sunuke = [i for i in range(1,N+1)]

for a in A:
	for s in sunuke:
		if s in a:
			sunuke.remove(s)

print(len(sunuke))
N, K = list(map(int, input().split()))
d = []
A = []
B = set()
for i in range(K):
    _d = int(input())
    _A = list(map(int, input().split()))
    d.append(_d)
    A.append(_A)
    _B = set(_A)
    B = B or _B
print(N - len(B))
n, k = map(int, input().split())

snucks = set(i for i in range(1, k + 1))

for snack in range(1, k + 1):
    d = int(input())

    for snuck in map(int, input().split()):
        if snuck in snucks:
            snucks.remove(snuck)

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

for i in range(k):
    d=int(input())
    l.append(map(int,input().split()))
    
x=set(l)
x=list(x)
print(n-len(x))
n,k = map(int,input().split())

z = 0
l = [0]
for i in range(k):
  d=int(input())
  s =list(map(int,input().split()))
  l.extend(s)
  
print(l)
for i in range(n+1):
  if l.count(i)==0:
    z = z + 1
print(z)
import sys
N, K = map(int, input().split())
a = [0] * N
a = [list(map(int, input().split())) for _ in range(K*2)]
Sunuke = list(range(1,N+1))
#print(a)

for i,word in enumerate(a):
#	print("i",i,word)
	if (i % 2) == 1:
#		print(word)
		for j,check in enumerate(Sunuke):
			if check in word:
#				print(check,word,Sunuke)  
				Sunuke.remove(check)
print(len(Sunuke))
n, k = map(int, input().split())
snk = [-1] * (n + 1)
ans = -1
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:
        ans += 1
print(ans)
N, K = map(int, input().split())
A = []
a = []

for i in range(N):
    a.append(i + 1)

for i in range(K):
    d = int(input())
    A = [int(x) for x in input().split()]
    try:
        for j in range(d):
            a.remove(A[j])
    except:
        pass
    d = ""
    A = []

print(len(a))
# coding=utf-8

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

    sunuke = [0] * N
    print(sunuke)

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

        for j in range(D):
            sunuke[li[j] - 1] += 1
            #print(sunuke)

    print(sunuke.count(0))
# 166 B

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

print(n - (len(set(a))))
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())
	s.add(a)
	l=list(map(int,input().split()))
print(n-len(s))
n, k = map(int, input().split())
missing = 0
snuke = []
for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    snuke.append(d)

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

for i in range(n):
  if N[i] in A:
    count += 1
print(A)
print(n-count)
n,k = [int(ch) for ch in input().split()]
snuckList = []
for i in range(n):
    snuckList.append(i+1)
for i in range(k):
    snuck = int(input())
    snackList = input()
    if snuck in snuckList:
        snuckList.remove(snuck)
print(len(snuckList))
N, K = map(int, input().split())

d = []
A = []
for i in range(K):
    d_pre = int(input())
    A_pre = [int(x) for x in input().split()]
    d.append(d_pre)
    A.extend(A_pre)

A_unique = list(set(A))

ans = 0

for i in range(1, N):
    if i in A_unique:
        pass
    else:
        ans += 1

print(ans)
N,K = map(int,input().split())
ls = [0 for i in range(N)]
for i in range(K):
  d = int(input())
  A = list(map(int,input().split()))
  for j in range(d):
    ls[A[j]-1] += 1
for i in range(N):
  if ls[i] == 0:
    print(i+1)
N_nin, K_ko = map(int, input().split())

sunuke = []

for i in range(K_ko):
    d = int(input())
    
    if (d != 1):
        sunuke.append(map(int, input().split()))
    else:
        sunuke.append(int(input()))

ans = N_nin - len(set(sunuke))

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

set_i = set()

for i in range(0,k,2):
  d = input()
  s = map(int,input().split())
  for s_ in s:
    set_i.add(s_)

print(n-len(set_i))
n,k = map(int, input().split())
L = [list(map(int, input().split())) for i in range(2*k)]
A = []
for i in range(k-1):
  A = A + L[2*i + 1]
ans = 0
for i in range(n):
  if i+1 not in A:
    ans += 1
    
print(ans)
a,b = map(int, input().split())
s=[]
for _ in range(b-1):
 try:
   p=input().split()
 except:
  p=""
 try:
  r=input().split()
  for b in r:
   for bb in b:
    s.append(int(bb))
 except:
  r=""
result = list(filter(lambda x: x not in list(set(s)), list(range(1,a+1))))
print(len(result))
n, k = map(int, input().split())
for i in range(k):
    d = int(input())
    A = set([int(x) for x in input().split()])
print(len(A))
n,k=map(int,input().split())
list_a=[]
for d in range(k):
  d=int(input())
  a=list(map(int,input().split()))
  list_a.extend(a)
ans=0
for i in range(1,n): 
 if list_a.count(i)==0:
      ans+=1
print(ans)
[N, K] = list(map(int, input().split()))
all_A =[]
after_A =[]
for i in range(1, N + 1):
    all_A.append(i)
for j in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    after_A = set(after_A) ^ set(A)
print(len(after_A))
n, k = map(int,input().split())
list = []
if k ==1:
  d = input()
  #print(i)
  for a in map(int,input().split()):
    list.append(a)
    
else:
  
  for i in range(0,k-1):
    d = input()
    #print(i)
    for a in map(int,input().split()):
      list.append(a)
    
    
#print(list)
print(n - len(set(list)))
NK = list(map(int, input().split()))
ans = [0]*NK[0]

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

for i in range(k):
    d = int(input())
    a = list(map(int,input().split()))
    for j in range(d):
        s[a[0]] += 1
        
s[0] += 1
print(s.count(0))
n,k=map(int,input().split())
for i in range(k):
    d=int(input())
    a=set(int(i) for i in input().split())
print(n-len(set(a)))
def resolve():
    N, K = map(int, input().split())
    A = []
    for i in range(K):
        d = int(input())
        a = map(int, input().split())
        A.append(a)
    print(N - len(set(A)))
resolve()
N,K=map(int,input().split())
res={' '}
for i in range(K):
    d=input()
    ki=list(input())
    res|=set(ki)
res=[x for x in res if x!=' ']
print(N-len(res))
n,k = map(int,input().split())
d = int(input())

ans = n-d

print(ans)
def main():
  s = list(map(int,input().split()))
  n = [0]*s[0]
  for k in range(0,s[1],1):
    d = int(input())
    a = list(map(int,input().split()))
    #print(a)
    for i in range(0,d,1):
      #print(a[i])
      n[a[i]-1] = 1
      #print(n)
      
  sum=0
  print(n)
  
  for k in range(0,s[0],1):  
    if(n[k]==0): sum = sum+1
 
  print(sum)
  
main()
N, K = list(map(int, input().split()))
people = [False for i in range(0, N)]

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

    for a in A:
        people[a-1] = True

print(len(list(filter(lambda x : x, people))))
from collections import Counter

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

l = []
counter = 0

for k in range(K):
    d = int(input())
    A = map(int, input().split())
    l.extend(A)

for i in range(1,K+1):
    if Counter(l)[i]==0:
        counter += 1
    else:
        continue
        
print(counter)
n, k = map(int, input().split())
s = set()
for _ in range(k):
    input()
    s.add(map(int, input().split()))
print(n - len(s))
N,K = map(int,input().split())
s = [input() for i in range(K*2)]
l = []
c = 0
k = 0
m = 0
# スペース区切りの整数の入力
num = []
for i in range(K*2):
  if i%2==1:
    for m in range(int(s[i-1])):
      num.append(s[i].split()[m])
for j in (1,N+1):
  k=num.count(str(j))
  if k == 0:
    c = c+1
print(c)