peterverebics/CodeNet_Python_118 huggingface dataset:
N, K = map(int, input().split())
A = []
A_row = []
check = []
count = 0

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

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

for i in range(0, N):
    for j in range(0, K):
        if check[i] == A_row[j]:
            check[i] = 'None'

for i in range(0, len(check)):
    if check[i] != 'None':
        count += 1
print(str(count))
N,K=map(int,input().split())
d=[]
A=[]
for i in range(K):
    d=int(input())
    A.append(map(int,input().split()))
print(N-len(set(A)))
if __name__ == '__main__':
    s = input()

    if s == "ABC":
        print("ARC")
    if s == "ARC":
        print("ABC")
n,k = map(int, input().split())
d = []
A = []
for _ in range(k):
    d.append(int(input()))
    A.append(list(map(int, input().split())))
    
import collections
c = collections.Counter(d)

print(n-len(c))
whatMan = []

N, K = input().split()
for i in range(int(K)):
    whatMan.extend(input().split())
print(int(N) - len(set(whatMan)))
import itertools
N, K = map(int, input().split())
d_list = []
A = []
a_set = set()
al_set = {i for i in range(N)}
for i in range(K):
    d_list.append(int(input()))
    A.append(list(map(int, input().split())))
for i in itertools.chain.from_iterable(A):
    a_set.add(i)
print(len(al_set - a_set))
n,k=map(int,input().split())

for i in range(k):
    ans=[]
    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))
def check(human):
    sum = 0
    for i in human:
        if(i == 0):
            sum += 1
    return sum

def resolve():
    data = [int(i) for i in input().split()]
    
    human = [0 for i in range(data[0])]
    sweet = data[1]
    
    for i in range(sweet):
        mem = int(input())
        have = [int(j) for j in input().split()]
        
        for k in have:
            human[k-1] += 1
    
    print(check(human))
def main():
	n,k = map(int,input().split())
	da = []
	for i in range(k*2):
		da.append(list(map(int,input().split())))
	print(da)
	okashi = []
	for i in range(1,k*2,2):
		if len(da[i]) > 1:
			for s in range(len(da[i])):
				okashi.append(da[i][s])
		else:
			okashi.append(da[i][0])
	print(n - len(set(okashi)))




if __name__ == '__main__':
	main()
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(list(set(arr1) - set(arr)))
n, k = map(int,input().split())
data = []
for _ in range(k):
    d = int(input())
    data.extend(list(map(int,input().split())))

print(data)
print(n-len(set(data)))
nk = input().split()
NK =[int(x) for x in nk]
t = []
s = []

for i in range(1,NK[1]+1):
    s.append(i)
    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())
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):
      all_sunuke[j] =all_sunuke[(a[j]-1)]*0

print(sum(all_sunuke))
def main():
    n,k = map(int, input().split())
    d = int(input())
    print(n-d)

if __name__ == '__main__':
    main()
n, k = map(int, input().split())
d = []
a = []
result = 0
for i in range(2 * k):
    if i % 2 == 0:
        d.append(int(input()))
    else:
        a.append(list(map(int, input().split())))

for j in range(n):
    cnt = 0
    for s in a:
        if (j + 1) in s:
            break
        else:
            cnt += 1
    if cnt >= 1:
        result += 1

print(result)
def Qb():
    n, k = map(int, input().split())
    ans = set()
    for v in range(k):
        d = int(input())
        ans.add(tuple(int(v) for v in input().split()))
        print(f'{d=}')
        print(f'{ans=}')
    print(n - len(ans))


if __name__ == '__main__':
    Qb()
N,K=map(int,input().split())
M=[]
i=0
for a in range(K*2):
   
    M= list(map(int, input().split()))
for b in range(1,N+1):
    if b not in M:
        i+=1
print(i)
n, k = map(int, input().split())
a = []
for i in range(k):
    d = 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))
N, K = list(map(int, input().split()))
lists = [i for i in range(1, N)]

for _ in range(K):
    n = int(input())
    a = list(map(int, input().split()))
    for j in a:
        if j in lists:
            lists.remove(j)
print(len(lists))
whatMan = []

N, K = input().split()
for i in range(int(K)):
    whatMan.extend(input().split())
print(whatMan)
if __name__ == '__main__':
    N, K = map(int, input().split())

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

    print(N - max_d)
n, k = map(int, input().split())
kouho = set(range(1, n))
for kashi in range(1, k):
  a = input()
  lst = map(int, input().split())
  for b in lst:
    kouho.discard(b)
print(len(kouho))
N,K = map(int,input().split())
d = [0 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()))
su_list = [i for i in range(1,K+1)]
for i in range(K):
    for j in range(d[i]):
        if A[i][j]-1 in su_list:
            su_list.remove(A[i][j]-1)        
print(len(su_list))
N,K = map(int,(input().split()))
n_list=[]
ans_list=[]
for i in range(N):
  ans_list.append(i+1)

for i in range(K):
  d = int(input())
  a_list = list(map(int, input().split()))
  n_list.extend(a_list)
  n_list = list(set(n_list))
print(*list(set(ans_list)-set(n_list)))
n,m = map(int,input().split())

d = {}

for i in range(m):
    input()
    L = list(map(int,input().split()))
    for j in L:
        d[j] = j

print(n - len(L))
N,K = map(int,input().split())
Sunuke = [i for i in range(N)]

for j in range(K):
    d = int(input())
    remove_list = list(map(int,input().split()))
    for k in remove_list:
        try:
            Sunuke.remove(k)
        except ValueError:
            pass

print(len(Sunuke) - 1)
nk = input().split()
n = int(nk[0])
k = int(nk[1])
s = [input() for i in range(k*2)]
o = []

for  j in range(len(s)):
    if j % 2 == 0:
        pass
    else:
        o[len(o):len(o)] = s[j]

l =list(set(o))
ans = n - len(l) 
print(ans)
N, K = map(int, input().split())
ANSlist = [1]*(N)
print(ANSlist)
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(N-1):
    if ANSlist[i] != 0:
        ANS += 1

print(ANS)
a,b = map(int, input().split())
List = [list(map(int, input().split())) for i in range(2*b)]
list_all=[]
Output = 0
for i in range(b):
  list_all = list_all+List[2*i]
set_a = set(list_all)
Output = a- len(set_a)
print(Output)
N, K = map(int, input().split())
list0 = [list(map(int, input().split())) for i in range(2*K)]
d = list0[0::2]
listd = list0[1::2]
listf = listd[0]
count = 0
for i in range(1, K):
  listf = listf + listd[i]

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

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

for n in N:
    print(n)
nums = [int(e) for e in input().split()]
N = nums[0]
K = nums[1]

list0 = []
for i in range(0, 2*K):
  val = input()
  if i%2 == 1:
      list0.append(val)

num = N - len(list(set(list0)))

print(num)
N, K=map(int, input().split())
sunuke=[list(map(str, input().split())) for _ in range(2*K)]
merge=[]
ans=0
for i in range(K):
  merge+=sunuke[2*i+1]
for j in range(1, 101):
  if str(j) not in merge:
    ans+=1
print(ans)
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])]=d

keys= [k for k, v in dic.items() if v == 0]
print(len(keys))
n, k = map(int, input().split())
check = [False for i in range(n)]

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

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

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

#print(sunuke)

for i in range(k):
  d = int(input())
  #print(d)
  A = list(map(int, input().split()))
  #print(A)
  for id, s in enumerate(sunuke):
    if s in A:
      sunuke.pop(id)
      #print("popされたよ")
      #print(sunuke)
print(len(sunuke))
n,k = map(int,input().split())
d = []
e = []
for i in range(k):
    d.append(int(input()))
    e.append(input())
f = list(set(e))
g = len(f)
print(n-g)
n, k = map(int, input().split())
lst = []
for i in range(k):
  d = int(input())
  a = list(map(int, input().split()))
  lst.append(d)
print(n-d)
n,k=list(map(int, input("").split()))
d=[]
a=[]
t=[]
for i in range(k):
    d.append(int(input()))
    a.append(list(map(int, input("").split())))
for i in range(n):
    t.append(True)
for i in range(k):
    for j in range(d[i]):
        if t[j-1]:
            t[j-1]=False
out=0
for i in t:
    if i:
        out+=1
print(out)
N, K = map(int, input().split())
d = []
A = []
for _ in range(K):
  d.append(int(input()))
  A.append(list(map(int, input().split())))

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

x = -1
for i in range(n):
  if l[i] == 0:
    x += 1
  
print(x)
n,k = list(map(int,input().strip().split()))
temp = []
ans = int(n)
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 + 1):
    b = str(m + 1)
    a = temp.count(b)
    if a != 0:
        ans -= 1
print(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 j in range(len(a)):
        l[j-1] += 1

print(l.count(0))
N, K = map(int, input().split())
data = set(range(1, N - 1))
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().strip().split())
seen_ds = set()
for _ in range(k):
  d = input().strip()
  _ = input()
  seen_ds.add(d)
  
print(n - len(seen_ds))
x = input()
n = int(x.split()[0])
k = int(x.split()[1])
moji = ''
count = 0
 
for i in range(k * 2):
  s = input()
  if i % 2 != 0:
    moji = moji + s + ' '
for i in range(n):
  num = str(i+1)
  if moji.count(num):
    count
  else:
    count = count + 1
    
print(count)
[N, K] = list(map(int, input().split()))
all_A =[]
for i in range(N):
    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))
import itertools
N, K = map(int, input().split())
snack = [list(map(int, input().split())) for i in range(2*K)]
answer = []
person = 0

for i in snack[1::2]:
    for j in i:
      if not j in answer:
        answer.append(j)
      else:
        break
    else:
	    person += 1
print(person)
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 =map(int,input().split())

D=[]
A=[]
C=[]
for i in range(k):
    D.append(int(input()))
    A.append(list(map(int,input().split())))
for i in range(1,n+1):
    C.append(int(i))

for i in range(k-1):
    for a in A[i]:
        if C.count(a)!=0:
            C.remove(a)
        
print( len(C) )
N,K=map(int,input().split())
count=0
who=[]
while(K!=0):
    k=int(input())
    someone=list(map(int,input().split()))
    if(len(someone)!=0):
        for i in someone:
            who.append(i)
            someone.remove(i)
    K-=1
print(N-len(set(who)))
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(a))
n,k = map(int, input().split())
d = int(input())
l = list(map(int, input().split()))
print(n-d)
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(len(l))
n, k = map(int, input().split())
a = [0] * (n+1)
cnt = -1
b = []

for i in range(k):
    d = int(input())
    b.append(input().split())
    # print(b)

    for j in range(d):
        b[i][j] = int(b[i][j])
        a[b[i][j]] += 1
for i in range(n):
    if a[i] == 0:
        cnt += 1

print(cnt)
n,*t=open(0)
print(int(n[:2])-len({*''.join(t[1::2]).split()}))
N, K = list(map(int, input().split()))

sunukes = [0] * N

for i in range(K):
    d = int(input())
    kashimochi = list(map(int, input().split()))
    for j in range(len(kashimochi)):
        sunukes[j-1] = 1


print(sunukes.count(0))
N, K = [int(x) for x in input().split()]
s = set()
for i in range(K):
    d = int(input())
    for a in map(int, input().split()):
        s.add(a)
ans = sum([a not in s for a in range(1, K+1)])
print(ans)
N,K = map(int,input().split())
d = int(input())

print(N-d)
n,k = map(int,input().split())
d = int(input())
n -= d
print(n)
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)
print(N-len(e))
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)
N, K = map(int, input().split())
ans_list = []
for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    flag = 0
    while(flag == 0):
        if A[-1] > len(ans_list):
            ans_list.append(0)
        else:
            flag += 1
    for j in range(d):
        ans_list[A[j] - 1] += 1
ans = ans_list.count(0)
print(ans)
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(data)
print(data_remove)
print(len(data - data_remove))
n,k=map(int,input().split())
ans=[]

for i in range(k): #k種類のお菓子を順に見て行く
    d=int(input())  #参照しなくていい数
    a=list(map(int,input().split()))
    for j in a:    #そのお菓子を持っていれば配列の要素を1にする
        ans.append(1)

print(n-sum(ans)) #(全集合)-(お菓子を持っている人)
                  #n-(0+1+1+1+0+0+...)
n,k=map(int,input().split())
D=[0]*n
for i in range(k):
  a=list(map(int,input().split()))
  for j in range(len(a)):
    D[a[j]-1]+=1
res=0
for i in range(n):
  if not D[i]:
    res+=1
print(res)
N, K = map(int, input().split())
s = 0
for _ in range(K):
    d = int(input())
    A = input()
    if d > s: s = d
print(N - s)
# coding: utf-8
# Your code here!
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
    
#print(anslist)

checklist=str(anslist)
ans=0
j=0
while j<N:
    #print("HI")
    check=j+1
    #print(check)
    if str(check) not in checklist:
        ans+=1
    j+=1
    
print(ans)
N, K = map(int, input().split())
S = [input().split() for _ in range(K*2)]
new_list = []

for i in range(1,len(S)-2,2):
    for j in S[i]:
        new_list.append(j)

new_list = set(new_list)
print(N - len(new_list))
n, k = map(int, input().split())
count = [0 for _ in range(n)]

for _ in range(k):
    k = int(input())
    a = list(map(int, input().split()))
    for i in a:
        count[i - 1] += 1
a = ''
for i in range(len(count)):
    if count[i] == 0:
        a += str(i + 1) +' '
print(a)
import numpy as np

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

ans = N - len(np.unique(A))
print(ans)
NK = input()
N = int(NK.split()[0]) #すぬけくんの人数
K = int(NK.split()[1]) #お菓子
s = [input() for i in range(K*2)]
m = s[1::2]
l = list(set(m))
q = l[0].split()
output = N - len(q)
print(output)
NK = input()
N = int(NK.split()[0]) #すぬけくんの人数
K = int(NK.split()[1]) #お菓子
s = [input() for i in range(K*2)]
m = s[1::2]
q = m[0].split()
output = N - len(q)
print(output)
n,k=map(int,input().split())
ans=0
lis=[0 for i in range(n)]
for i in range(k):
  d=int(input())
  ll=map(int,input().split())
  for j in ll:
    lis[j-1]+=0
for i in lis:
  if i==0:
    ans+=1
    
print(ans)
N,K=map(int,input().split())
hoge={}
for j in range(K):
    input()
    [hoge.update({int(j):1}) for j in input().split()]
print(sum([not j in hoge for j in range(N)]))
n, k = map(int, input().split())
a = [list(map(int,input().split())) for i in range(2*k)]
ans = 0
for i in range(k):
  b = set(a[2*i-1])
  ans = max(ans, len(b))
print(n-ans)
def extract(lst, value):
    return [i for i, x in enumerate(lst) if x == value]


import numpy as np

N, K = map(int, input().split())
d = []
A = np.zeros(N + 1)
A[0] = 1
for _ in range(K):
    int(input())
    li = list(map(int, input().split()))
    for i in li:
        A[i] += 1
print(extract(A, 0))
print(A)
from collections import defaultdict

N, K = list(map(int, input().split()))
d = {}
for i in range(1, N+1):
    d[i] = []
print(d)
for k in range(1, K):
    input()
    for i in map(int, input().split()):
        d[i].append(k)
count = 0
for i in range(1, N+1):
    if len(d[i]) == 0:
        count += 1
print(count)
x=input()
x_list=x.split()
N=int(x_list[0])
K=int(x_list[1])

Z=set()

for i in range(K):
  s=int(input())
  c=input()
  c_list=c.split()
  Z.add(c.split)

print(N-len(Z))
#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().split()
    for i in a:
        if i in sunuke:
            sunuke.remove(i)
    print(sunuke)

ans = len(sunuke)

print("{}".format(ans))
n, k = map(int, input().split())
a = [x*0 for x in range(n)]
count = 0

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

print(count)
import collections
N,K=map(int,input().split())
sunuke=[]
d=[]
for i in range(K):
    d.append(input())
    sunuke.append(input())
have_okashi=collections.Counter(sunuke)
print(N-len(have_okashi))
N,K=map(int,input().split())
kashi_num = [str(i+1) for i in range(N)]
for _ in range(K):
  d = input()
  for a in input().split():
    if a in kashi_num:
      kashi_num.remove(a)
print(' '.join(kashi_num))
N,K = map(int,input().split())
s = [input() for i in range(K*2)]
l = []
c = 0
k = 0
m = 0
f = []
# スペース区切りの整数の入力
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):
  f.append(num.count(str(j)))
print(N-len(f))
n,k=map(int,input().split())
d=int(input())
if n-d >=0:
	print(n-d)
else:
	print('0')
O= input()
N ,K = O.split()
list=[]
for i in range(int(K)):
    new = input()
    new2= input()
    list.append(new2)
list= set(list)
length = len(list)
print(int(N) - length)
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-1]

    for w in range(n):
        if snukes[w] is None:
            victims += 1
    
    print(victims)

solve(n, k)
N,K=map(int,input().split())
l = []
for k in range(K):
    a = int(input())
    lis=list(map(int,input().split()))
    print(lis)
    l.extend(lis)
print(l)
for j in range(N):
    if not j+1 in l:
        print(j+1)
n,k=map(int,input().split())
d=[]
a=set()
for i in range(k):
    d.append(int(input()))
    l=list(input())
    a=a|set(l)
a.discard(' ')

print(n-len(a))
N, K = map(int, input().split())
has_snack = [False]*N

for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for v in A:
        has_snack[v-1] = True

print(sum(has_snack))
#ABC166
n,k=map(int,input().split())
cnt=[0]*(n+1)
for j in range(k):
  tmp = int(input())
  arr=list(map(int,input().split()))
  for val in arr:
    cnt[val]+=1
ans=0
for i in range(1,n+1):
  if cnt[i]==0:
    ans+=1
print('Anser is ' + str(ans))
N, K = map(int, input().split())
klis = [1 for i in range(N)]
for i in range(K):
  l = int(input())
  for j in input():
    if j == ' ':
      continue
    else:
      klis[int(j)-1] = 0
  
print(sum(klis))
N, K = map(int, input().split())

A = []
for i in range(K):
    a = int(input())
    b = map(int, input().split())
    if a not in A:
        A.append(a)
count = 0

for i in A:
    count += 1

print(N - count)
n, k = map(int, input().split())
sunukes = [list(map(int, input().split())) for i in range(k*2)]

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

print(len(names))
n,k = list(map(int,input().strip().split()))
temp = []
ans = int(n)
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())

list_sunuke = list(range(1,N+1))
list_A = []

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

    list_A.append(A_list)
for _ in list_A:
    if _ in list_sunuke:
        list_sunuke.remove(_)


print(len(list_sunuke))
n,k = [int(x) for x in input().split(' ')]

def solve(n, k):
    snukes = [0] * 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-1]

    for w in range(n):
        if snukes[w] == 0:
            victims += 1
    
    print(snukes)
    print(victims)

solve(n, k)
NK = list(map(int, input().split()))
ans = [1]*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) == 0:
      ans[j] = 0
print(NK[0]-sum(ans))
n,k=map(int,input().split())

d=[0]*k
a=set()
for i in range(k):
    d[i]=int(input())
    if d[i]>1:
        a.add(map(int,input().split()))
    else:
        a.add(int(input()))
    
print(n-len(a))
N, K = map(int, input().split())
list0 = [list(map(int, input().split())) for i in range(2*K)]

listd = list0[1::2]
listf = listd[0]
count = 0
for i in range(1, K):
  listf = listf + listd[i]

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

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

list_sunuke = list(range(1,N+1))
list_A = []

for k in range(K):
    d = int(input())
    A_list = list(map(int,input().split()))
    list_A.append(tuple(A_list))
    
set_A = set(tuple(list_A))

print(len(list_sunuke) - len(set_A))
first_line = list(map(int, input().split()))
N = first_line[0]
K = first_line[1]
rest = list(range(1, N+1))
for i in range(K):
  d = int(input())
  given = list(map(int, input().split()))
  for j in range(1, N+1):
    if j in given and j in rest:
      print(j)
      rest.remove(j)

print(len(rest))
N, K = [int(x) for x in input().split()]
s = set()
for i in range(K):
    d = int(input())
    if d == 1:
        s.add(int(input()))
    else:
        for a in input().split():
            s.add(int(a))
ans = sum([a not in s for a in range(1, K+1)])
print(ans)
n, k = map(int, input().split())

lis = [0] * n

for i in range(k):
    num = int(input())
    dos = list(map(int, input().split()))
    for k in range(num):
        lis[k] += 1

count =0
for p in range(n):
    if lis[p] == 0:
        count += 1
        
print(count)