peterverebics/CodeNet_Python_118 huggingface dataset:
NK = list(map(int, input().split()))
N = NK[0]
K = NK[1]

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

print(N - max(d))
N, K = map(int, input().split())
sunu = [0] * (N + 1)
for _ in range(0, K):
    a = list(map(int, input().split()))
    for s in a:
        sunu[s] += 1

print(sunu.count(0))
N, K = [int(x) for x in input().split(" ")]
A = [0 for i in range(N)]

for k in range(K):
    d_i = int(input())
    holder_list = [int(x) for x in input().split(" ")]

    for hi in holder_list:
        A[hi-1] += 1

count_non_holder = 0
for a in range(len(A)):
    if a == 0:
        count_non_holder += 1

print(count_non_holder)
n,k=map(int, input().split())
peoples=[]
for i in range(k):
    candies = input()
    # リストに追加
    tmp = [int(i) for i in list(input().split())]
    peoples.extend(tmp)

# listから重複を削除し
print(3-len(set(peoples)))
n, m = map(int, input().split())
ql = [tuple(map(int, input().split())) for i in range(2*m)]
a = ql[1::2]
ans = n - len(set(a))
if ans <= 0:
    print(0)
else:
    print(ans)
#!/usr/bin/env python3


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    N, K = list(map(int, input().split()))
    ans = [0] * N
    for i in range(K-1):
        d = int(input())
        A = list(map(int, input().split()))
        for j in A:
            ans[j-1] += 1

    a = 0
    for i in ans:
        if i==0:
            a += 1
    print(a)
    return

if __name__ == '__main__':
    main()
N, K = map(int, input().split())
a = []
for i in range(K):
  di = int(input())
  a.append(map(int, input()))
  
    

a = set(a)
print(N - len(a))
n, k = map(int, input().split())
lists = [input() for _ in range(k * 2)]

suspects = set(map(str, set(range(n))))
has_snack = set()
for i, v in enumerate(lists):
    if i % 2 == 1:
        continue
    for j in v.split():
        has_snack.add(j)
obake = suspects - has_snack

print(len(obake))
n, k = map(int, input().split())
kids = list()
for i in range(k):
    d = input()
    kids += list(map(int, input().split()))
res = 0
print(kids)
for i in range(1,n+1):
    if i not in kids:
        res+= 1
print(res)
N, K = map(int, input().split())
d = [0] * K
y = [0] * N
for i in range(K):
    d[i]=int(input())
    A= list(map(int, input().split()))
    for x in A:
        y[x-1]+=1
for ans in y:
    if ans==0:
        print(y.index(ans)+1)
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(1,NK[0]+1):
    if table.count(j) != 0:
      ans[j-1] = 1
print(NK[1]-sum(ans))
N, K = map(int, input().split())
 
tmp = set()
 
for i in range(K):
  input()
  tmp |= set(input())
 
print(N - len(tmp) + 1)
n, k= map(int, input().split())
num = range(1,n)
c = set()
num = set(num)
for i in range(k):
  a = input()
  b = set(list(map(int, input().split())))
  c = b | c
num = list(num -c)
L=[str(a) for a in num]
L=" ".join(L)
print(L)
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 ai in range(d[i]):
    if ans[ai] == 1:
      ans[ai] = 0
      
      
print(sum(ans))
n,k = map(int,input().split())
master = []
count = 0
for num in range(k):
    d = input()
    sunuke = list(map(int,input().split()))
    master+=sunuke

print(3-len(set(master)))
s=input()
N,K=s.split()
N=int(N)
K=int(K)
line=[]
number=[]
count=0
for n in range(K*2):
    line+=[input()]
for m in range(K):
    line[2*m+1]=line[2*m+1].split()
    number+=line[2*m+1]
for i in range(K):
    if str(i+1) in number:
        count+=1
print(K-count)
n, k= map(int, input().split())
num = range(1,n)
c = set()
num = set(num)
for i in range(k):
  a = input()
  b = set(list(map(int, input().split())))
  c = b | c
num = list(num -c)
print(len(num))
#!/usr/bin/env python3

# input
n, k = map(int, input().split())
d = [-1 for _ in range(k)]
A = [[] for _ in range(k)]
for i in range(k):
    d[i] = int(input())
    A[i] = list(map(int, input().split()))

# calc
okashi = [0 for _ in range(n)]
for i in range(k):
    for j in range(d[i]):
        okashi[j] += 1

ans = 0 
for i in range(len(okashi)):
    if okashi[i] == 0:
        ans += 1
print(ans)
n,k = map(int, input().split())
s = [1]*n
for i in range(k):  
    d = int(input())
    a = map(int, input().split())
    for i in range(d):
        if s[i] == 1:s[i] = 0
print(sum(s))
N, K = map(int, input().split())
D = []
count = 0
sunuke_list = [0] * N
print(sunuke_list)
for j in range(K * 2):
    D = list(map(int, input().split()))
    if j % 2 == 1:
        for i in range(len(D)):
            sunuke_list[i - 1] = 1
        print(sunuke_list)

print(N - sum(sunuke_list))
n,k = map(int,input().split())
sunuke=[]
for i in range(k):
    d = int(input())
    if d >= 2:
        a = input().split()
        sunuke.extend(a)
    else:
        a = input()
        sunuke.extend(a)
print(n-len(set(sunuke)))
line1 = list(map(int, input().split()))
peple = list(range(line1[0]))
kashi = list(range(line1[1]))


i = 1
while i < len(kashi) + 1:

    holder_count = input()
    holder = list(map(int, input().split()))

    for j in holder:

        try:
        	peple.remove(int(j))
        except ValueError:
        	pass
        finally:

            i = i + 1
peple.remove(0)            
print(len(peple))
N,K = map(int,input().split())

L = []

for i in range(K):
  d = int(input())
  A = list(map(int,input().split()))
  print(A)
  for _ in A:
    if not _ in L:
      L.append(_)
ans = N - len(L)
print(ans)
N, K = input().split(" ")

d_num = int(input())

okasi_nasi = set()
for i in range(int(K)*2):
    if i % 2 == 1:
        okasi_nasi = okasi_nasi | set(input().split(" "))

print(int(N) - len(okasi_nasi))
n, k = map(int, input().split())
s = ''
for i in range(n):
    s += str(i+1)
for i in range(k):
    input()
    ts = input().split(' ')
    for t in ts:
        s = s.replace(t, '')
print(len(s))
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[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 = [list(map(int,input().split())) for i in range(2*K)]
num = 0
# 偶数行に１〜Nが入っているか確認する
for w, name in enumerate(A[1::2]):
  print(w)
  print(A[1::2][w])
  if w+1 in A[1::2][w]:
    print(num)
    num = num +1
    print(num)
print(num)
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#l = list(map(int, input().split()))

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

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


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

print (ans)
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()))
    for j in range(len(A)):
        a.append(j)
a = set(a)
print(n-len(a))
n,k = map(int,input().split())
count = []
for i in range(1,n+1):
    count.append(i)
    
for i in range(k):
    d = int(input())
    A = list(map(int,input().split()))
    ans = set(count)-set(A)
    
print(len(ans))
n,k=map(int,input().split())
ans=[]
for i in range(k):
    d=int(input())
    li=list(map(int,input().split()))
    for j in range(1,n+1):
        if  (j not in li) and (j not in ans):
            ans.append(j)
print(len(ans))
N,K=map(int,input().split())

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

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

for i in d:
    for j in range(i):
        sweet[j]=1

num=0
for i in range(N):
    if sweet[i]==0:
        num+=1

print(num)
N,K= map(int,input().split())
list1 = []

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


for j in range(K):
    d =int(input())
    lista = list(map(int,input().split()))
    for l in list1:
        for h in lista:
            if (l==h):
                list1.remove(l)

print(len(list1))
n,k=map(int,input().split())
a=[]
cnt=0
for i in range(k):
    d=int(input())
    x=[int(e) for e in input().split()]
    for j in x:

        a.append(j)

for j in range(len(a)-1):
    if a[j]!=a[j+1]:
        cnt+=1
print(n-cnt-1)
N, K = map(int, input().split())
d = []


C = [0 for i in range(N+1)]
for i in range(K):
    d.append(input())  #Kこの文字列を読み込み　行列

    A = list(map(int, input().split())) #一行ずつ処理


    for v in A:
        C[v-1] = 1


print(N-sum(C))
print(d)
print(A)
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[j]=a[j]-1

print(sunuke.count(0))
import itertools

N, K = map(int, input().split())
i=0
dlist=[]
mlist=[]

while(i<K) :
  d = int(input())
  val = map(int, input().split())
  dlist.append(d)
  mlist.append(val)
  i+=1

j=1
res=0

list=list(itertools.chain.from_iterable(mlist))

if(N==0):
  j=0
else:
  j=1

while(j<N):
  if(list.count(j)==0):
    res+=1
  j+=1

print(res)
N,K=map(int,input().split())
D=[]
A=[]
for i in range(K):
    d=int(input())
    D.append(d)
    Ai=[int(x) for x in input().split()]
    A.append(Ai)
NUMBERS=[int(x) for x in range(1,N+1)]
for i in range(K):
    for j in range(D[i]):
        if A[i][j] in NUMBERS:
            NUMBERS.remove(A[i][j])
for i in range(len(NUMBERS)):
    print(len(NUMBERS))
"""
ある街にN人のすぬけ君(すぬけ君1、すぬけ君2、 ...、 すぬけ君N)が住んでいます。

"""
n, k = map(int, input().split())
n_list = list(range(1, n+1))
input_map = {}
for i in range(k):
    d = int(input())
    d_list = [ int(ai) for ai in input().split()]
    input_map.setdefault(d, d_list)


having_map = {}
for key, value in input_map.items():
    for h in value:
        print(value)
        if n_list.count(h) >= 1:
            n_list.remove(h)

print(len(n_list))
import itertools
N,K = map(int, input().split())
c = []
for i in range(K):
	a = int(input())
	b=list(map(int,input().split()))
	c.append(b)
f = list(itertools.chain.from_iterable(c))
d = []
for i in range(1,N+1):
	e =  i in f
	if e  == False:
		d.append(i)
length = len(d)
for i in range(length):
	print(d[i])
N,K=map(int, input().split())
kosu = []
for i in range(N):
  kosu.append(0)
for i in range(K):
  d = int(input())
  A=list(map(int, input().split()))
  for t in range(d):
    kosu[t] += 1
print(len([1 for x in kosu if x==0]))
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n,k = mi()
aa = [[]for _ in range(k)]
for i in range(k):
    d = ii()
    aa[i] = li()

dp = [0]*(n+1)
dp[0] = 1
for i in range(k):
    for l in aa[i]:
        dp[l] = 1
ans = 0
for i in range(n):
    if dp[i] == 0:
        ans += 1
print(ans)
n,k = list(map(int, input().split()))
hoge = [1] * n

for i in range(k * 2):
  if i % 2 == 0:
    a = list(map(int, input().split()))
    for j in a:
      hoge[j - 1] = 0
      
print(sum(hoge))
n,k = map(int,input().split())
s = set()
for i in [0]*k:
  _ = input()
  s|=set(map(int,input().split()))
print(k-len(s))
N, K = map(int, input().split())
c = 0
n = 1
for i in range(K):
  d = int(input())
  List = list(map(int, input().split()))
for I in range(N):
  if n in List:
    n = n+1
  else:
    c = c+1
    n = n+1
print(c)
line1 = list(map(int, input().split()))
peple = list(range(line1[0]+1))
kashi = list(range(line1[1]+1))
peple.remove(0)
kashi.remove(0)

i = 1
while i < kashi[-1]:

    holder_count = input()
    holder = list(map(int, input().split()))

    for j in holder:

        try:
        	peple.remove(int(j))
        except ValueError:
        	pass
        finally:

            i = i + 1

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

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

ans = 0

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

print(ans)
N,K=map(int,input().split())
i=int(input())
print(N-i)
n,k = map(int,input().split())
a=[list(map(int,input().split())) for _ in range(2*k)]
b=[]
for i in range(k):
  b += a[2*i]
c=set(b)
print(n-len(c))
n, k = map(int, input().split())
l = [0]*n
for i in range(k):
  d = int(input())
  a = [int(x) for x in input().split()]
  for j in range(d):
    l[a[j]-1] += 1

l = str(l)
print(l.count('0'))
n,k=map(int,input().split())
list_a=[]
for d in range(k-1):
  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)
line1 = list(map(int, input().split()))
peple = list(range(line1[0]+1))
kashi = list(range(line1[1]+1))
peple.remove(0)
kashi.remove(0)

i = 1
while i < len(kashi):

    holder_count = input()
    holder = list(map(int, input().split()))

    for j in holder:

        try:
        	peple.remove(int(j))
        except ValueError:
        	pass
        finally:

            i = i + 1

print(len(peple))
nk = input().split()
n = int(nk[0])
k = nk[1]
d = int(input())
print(n-d)
N,K = map(int,input().split())
li = []
count = 0
for i in range(K):
    d = int(input())
    a = list(map(int,input().split()))
    li.append(a)

for i in range(N):
    if i+1 not in li:
        count += 1

print(count)
import itertools
N, K = map(int, input().split(' '))

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

result = 0 
A_all = list(itertools.chain.from_iterable(A_all))
for i in range(1, N + 1):
  if A_all.count(i) == 0:
    print(i)
    result += 1
      
print(result)
import collections
N,K=map(int,input().split())
a=[]
while K>0:
  K=K-1
  d=int(input())
  a.append(map(int,input().split()))
e=collections.Counter(a)
print(N-len(e))
n,k = map(int,input().split())

sunukes = list()
for i in range(1,k+1):
    sunukes.append(i)

sunukes = set(sunukes)

for i in range(1,k+1):
    input()
    sunukes = sunukes - set(map(int,input().split()))

print(len(sunukes))
N, K = map(int, input().split())
A = []
for i in range(K):
    d = int(input())
    B = list(map(int, input().split()))
    A.extend(B)
E = list(set(A))
F = N - len(E)
N,K=map(int,input().split())
 
D=[0]*N
 
for i in range(K):
    r = int(input())
    d = list(map(int,input().split()))
    for j in range(r):
        D[d[j]-1] = 1
 
 
cnt = 0
for i in range(N):
    if D[i] == 0:
        cnt += 1
n,k=map(int,input().split())
lists=[]
for _ in range(k):
  d=int(input())
  lis=list(map(int,input().split()))
  lists.append(lis)
ans=[0]*n
for list in lists:
  for i in range(len(list)):
    ans[list[i]-1]+=1
count=0
for h in ans:
  if h==0:
    count+=1
n, k = map(int, input().split())


temp_array = []

for _ in range(k):
  temp = input()
  [temp_array.append(i) for i in list(map(int, input().split()))]

all_member = len(list(set(temp_array)))
print(k - all_member)
N,K=map(int,input().split())

con = 0
ans = list(int() for _ in range(10000))
pre = 0


for _ in range(K):

    D = int(input())
    arr = list(map(int,input().split()))

    for j in range(D):

        ans[pre+j]=arr[j]

    pre += D

        
fin = (N+1) - len(set(ans))

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

s0 = set([i for i in range(1,N)])
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())
D=[]
A=[]
for i in range(1,k+1):
    d = set(map(int, input().split())) 
    a = set(map(int, input().split())) 
    D.extend(d)
    A.extend(a)
l = set(A)
ans = []
for i in range (1,n+1):
  if i not in l:
    ans.append(i)
if len(ans) ==1:
  print(ans[0])
else:
  print(*ans)
#intの場合

L, R = map(int,input().split())
dell = set(range(1, L))
answer = set(range(1, L))

for x in range(R):
  intA = int(input())
  dell = list(map(int, input().split()))
  
  answer = answer.difference(dell)

print (len(answer))
N,K = list(map(int, input('').split(' ')))
D = set()
for i in range(K):
  input('')
  D |= set(map(int, input('').split(' ')))
print(K-len(D))
N,K=map(int,input().split())
l=[list(map(int, input().split())) for i in range(2*K)]

s=[]
for j in range(1,K+1,2):
    s.append(l[j])

counts=0
for k in range(1,K+1,2):
    for n in range(1,N+1):
        if l[k].count(n)==0:
            counts+=1

print(counts)
N, K = input().split()
d = []
x2 = []
count = 0
for i in range(0, int(N)):
  x2.append(0)
for i in range(0, int(K)):
  d = int(input())
  x = input().split()
  for j in x:
    if x2[int(j)-1] == 0:
      x2[int(j)-1] = 1
      count += 1
print(count)
N,K=map(int,input().split())
d = [0]*K
A = [[]]*K
ps=[1]*N
for i in range(K):
    d[i] = int(input())
    A[i] = input().split()
    for j in range(len(A[i])):
        A[i][j] = int(A[i][j])


for p in range(N):
    for i in range(K):
        if p in A[i]:
            ps[p-1]=0

print(sum(ps)-1)
N,K=map(int,input().split())
L=[]
for i in range(K):
  d=int(input())
  L.append(map(int,input().split()))
m=len(set(L))
print(N-m)
# 166 B

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

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

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

for i in range(K):
    d=int(input())
    a=list(map(int,input().split()))
    b=set(sunuke_list)-set(a)
    sunuke_list=list(b)
    print(sunuke_list)
    
print(len(sunuke_list))
n, k = map(int, input().split())
all_sunuke = [1]*n

for i in range(0,k):
  d = int(input())
  a = list(map(int, input().split()))
  for j in range(0,d):
    if a[j] != 0:
      all_sunuke[j] =all_sunuke[j]*0

print(sum(all_sunuke))
# coding: utf-8
# Your code here!
def main():
    n, k = map(int, input().split())
    
    for i in range(k):
        d = int(input())
        a_set = set(map(int, input().split()))
        if i == 0:
            ans = a_set
        else:
            ans.union(a_set)
    ans = len(set(range(1, n+1)) - ans)
    print(ans)
    
main()
#! /usr/bin/env python3

from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement

N, K = [int(_) for _ in input().split()]
A = [[int(_) for _ in input().split()] for i in range(K+K)]
A = [A[i] for i in range(K) if i % 2 == 1]
a = []
for i in A:
    a += i
print(N - len(list(set(a))))
nk = list(map(int, input().split()))
dic={}
for i in range(1,nk[0]):
    dic[str(i)]=0
for i in range(nk[1]):
    d=int(input())
    a = list(map(int, input().split()))
    for j in range(len(a)):
        dic[str(a[j])]=1

keys= [k for k, v in dic.items() if v == 0]
print(len(keys))
import math
n, k = map(int, input().split())
d = []
a = []
for i in range(k):
    d.append(int(input()))
    a.extend(input().split())
print(a)
ans = len(set(a))
print(n - ans)
"""
ある街にN人のすぬけ君(すぬけ君1、すぬけ君2、 ...、 すぬけ君N)が住んでいます。

"""
n, k = map(int, input().split())
n_list = list(range(1, n+1))
input_map = {}
for i in range(k):
    d = int(input())
    d_list = [ int(ai) for ai in input().split()]
    input_map.setdefault(d, d_list)

for key, value in input_map.items():
    for h in value:
        if n_list.count(h) == 1:
            n_list.remove(h)

print(len(n_list))
n,k = map(int, input().split())
di=[0]*k
Ap=[0]*n
for i in range(0,k):
    di[i] = int(input())
    A = list(map(int, input().split()))
    ai=0
    for j in range(1,di[i]+1):
        if A[ai]==j:
            ai=ai+1
            Ap[j-1]=1
num=0
for l in range(0,n):
    if Ap[l]==0:
        num=num+1
print(num)
n,k= map(int,input().split())
count = 3
maxcount = k*2+3
damy = []
answer = []
while count < maxcount:
    if count % 2 == 1:
	    count += 1
	    damy.append(input())
    else:
	    count += 1
	    answer.append(input())

answera = set(answer)
print(n-len((answera)))
N, K = input().split(" ")

d_num = int(input())

okasi_nasi = set()
for i in range(int(K)*2):
    if i % 2 == 1:
        buf = input()
        if buf[0] != "":
            okasi_nasi = okasi_nasi | set(buf.split(" "))

print(int(N) - len(okasi_nasi))
N,K=map(int,input().split())
l=[x for x in range(1,N+1)]
for i in range(1,K):
	d=int(input())
	A=list(map(int,input().strip().split()))
	for j in range(len(A)):
		if A[j] in l:
			l.remove(A[j])
print(len(l))
N, K = map(int, input().split())
List = []
void = 0
cnt = 0
for i in range(int(K)):
    void = int(input())
    List.append(list(map(int, input().split())))

arr = [int(x) for y in List for x in y]

for k in range(1,N):
    if k in arr:
        pass
    else:
        cnt += 1

print(cnt)
n,k = list(map(int,input().split()))
a=[]
d=[]
c=0
for i in range(k-1):
    d+=[int(input())]
    a+=list(map(int,input().split()))
    
for i in range(1,n+1):
    if i not in a:
        c+=1
print(c)
n,k = list(map(int, input().split()))
hoge = [1] * n

for i in range(k * 2):
  if i % 2 != 0:
    a = list(map(int, input().split()))
    for j in a:
      hoge[j - 1] = 0
      
print(sum(hoge))
N, K = map(int, input().split())
ANSlist = [1]*(N)
print(ANSlist)
for i in range(1,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(N-1):
    if ANSlist[i] != 0:
        ANS += 1

print(ANS)
N,K = map(int, input().split())
sunukes = [1 for _ in range(K)]
arr=[]
for _ in range(K):
  d = input()
  A=list(map(int, input().split()))
  arr = arr+A
print(len(list(set(sunukes) - set(arr))))
import sys

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

    sunuke = []
    for _ in range(K):
        _ = input()
        next_sunuke = list(map(int, input().split()))
        for i in next_sunuke:
            sunuke.append(i)

    print(sunuke)
    sunuke = set(sunuke)

    print(N - len(sunuke))

    return

if __name__ == '__main__':
    main()
    sys.exit(0)
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==0 or i%2 ==0:
    arr = arr+A
print(len(list(set(arr1) - set(arr))))
def l(): return [int(a) for a in input().split(" ")] 
ka = l()
lis = [a + 1 for a in range(ka[0])]
input()
for a in range(ka[1]):
  q = l()
  for b in q:
    if b in lis:
      lis.pop(lis.index(b))
print(len(lis))
N, K = map(int,input().split())
ans = {i for i in range(1,N)}
for i in range(K):
	d = int(input())
	A = set(map(int,input().split()))
	ans -= A
print(len(ans))
n,k=map(int,input().split())
print(n)
print(k)
d=[[] for i in range(k)]
dlist=[]
memb=[i+1 for i in range(n)]
for i in range(k):
    d[i]=int(input())
    dklist=list(map(int,input().split()))
    dlist.append(dklist)
    print(d[i])
    print(dlist[i])
    for j in dklist:
        print(j)
        if j in memb:
            memb.remove(j)
print(len(list(memb)))
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(a)
print(e)
print(N-len(e))
#coding:utf-8

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

sunuke = ["{}".format(i) for i in range(1,n+1)]

for i in range(k):
    d = int(input())
    a = input()
    for i in a:
        if i in sunuke:
            sunuke.remove(i)

ans = len(sunuke)

print("{}".format(ans))
n,k=map(int,input().split())
d=int(input())
print(n-d)
N, K = map(int, input().split())
#S = input()
Ai_list = []

for i in range(K):
    di = int(input())
    Ai_list += input().split()

print(Ai_list)
print(N - len(set(Ai_list)))
n, k = list(map(int, input().split()))
snukes = []
for x in range(k):
    input()
    y = ((list(map(int, input().split()))))
    for i in y:
        snukes.append(i)

print(len(snukes) - len(set(snukes)))