peterverebics/CodeNet_Python_118 huggingface dataset:
import sys
N, K = map(int, input().split())
a = []
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))
import sys
input = sys.stdin.readline

s = [0 for i in range(int(105))]
n, k = map(int, input().split())
for i in range(k):
    d, a = int(input()), list(map(int, input().split()))
    for a_i in a: s[a_i] += 1
print(s[:n].count(0)-1)
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(a))
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(1-sum(ans))
import numpy as np

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 = np.array(a)
a = np.unique(a)

print(N - len(a))
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):
  f.append(num.count(str(j)))
print(N-len(f))
from collections import defaultdict
N,K=map(int,input().split())
Hash=defaultdict(lambda:0)
for i in range(K):
    x=int(input())
    Hash[x]=1
    L=list(map(int,input().split()))
count=0
for i in range(1,N+1):
    if Hash[i]==0:
        count+=1
print(count)
N,K=map(int,input().split())
listX=[]

while K>0:
    dk=int(input())
    listk=input().split()
    listX=listX+listk
    K=K-1

listN=list(range(N+1))
listZ=list(set(listN)-set(listX))
L=str(len(listZ))
print(L)
n,k=map(int,input().split())
line=[]
for i in range(k):
    d=int(input())
    a=list(map(int,input().split()))
    for j in range(len(a)):
        line.append(a[j])
ans=len(set(line))
print(ans)
n, k = map(int, input().split())
list = []
for p in range(k):
  k_list = [int(x) for x in input().split()]
  m = len(k_list)
  for q in range(m):
    if not k_list[q] in list:
      list.append(k_list[q])
k_l = len(k_list)
print(n-k_l)
N, K = map(int, input().split())
d = []
A = []
for i in range(K):
    d.append(int(input()))
    A.append(list(map(int, input().split())))



print(N-max(d))
n,k=map(int,input().split())
d={}
for _ in range(k):
  a=int(input())
  l=list(map(int,input().split()))
  if a not in d:
    d[a]=1
    n=n-1
print(n)
N, K = map(int, input().split())
AA = []
ans = 0

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


for j in range(1,N):
  if AA.count(j) == 0:
    ans += 1

print(ans)
n,k = map(int,input().split())
count = []
for i in range(1,n+1):
    count.append(i)
    
for j in range(k):
    d = int(input())
    A = list(map(int,input().split()))
    ans = len(set(count)-set(A))
    
print(ans)
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+1,2):
  syoji = sunukes[i]
  okashi = sunukes[i+1]
  for n in okashi:
    if n in names:
      names.remove(n)

print(len(names))
#!/usr/bin/env python3

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

having_okasi = set()
for _ in range(k):
    d = int(input())
    if d == 1:
        having_okasi.add(int(input()))
    else:
        having_okasi.add(map(int, input().split()))

print(n - len(having_okasi))
import math as m

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

b = []
for i in range(n):
    b.append(0)

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

ans=0
for i in range(n):
    if b[i] == 0:
        ans += 1
print(ans)
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(k):
    b  = str(m + 1)
    a = temp.count(b)
    if a == 0:
        ans += 1
print(ans)
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(len(set(who)))
n, k = map(int, input().split())
count = {i: [] for i in range(n)}
for i in range(k):
    input()
    a = list(map(int, input().split()))
    for ii in a:
        count[ii-1].append(i)
sum(len(item)==0 for item in count.values())
n, k = list(map(int, input().split(" ")))
L = [0]*n

for v in range(k):
    d_ = int(input())
    d__ = input()
    d_l = list(map(int, d__.split(" ")))
    for v in range(d_):
        m = d_l[v]
        L[m-1] += 1
L.count(0)
import itertools

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

mans = []
for i in range(1, N+1):
    mans.append(i)

hasmans=[]
for ii in range(K):
    d = int(input())
    hasmans.append(list(map(int, input().split())))

hasmans = itertools.chain.from_iterable(hasmans)

print(*list(set(mans) - set(hasmans)))
n, k = map(int,input().split())
d = int(input())
total = n - d

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

ans = [0]*(N+1)

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

res = sum(ans)
print(res)
n,k=map(int,input().split())
dic={}
for i in range(n):
		dic[i+1]=0;
f=input()
for i in range(k):
	a=list(map(int,input().split()))
	
	for i in a:
		# print(i)
		dic[i]+=1
ans=0
# print(dic)
for i in dic:
	if(dic[i]==0):
		ans+=1
print(ans)
n, k = map(int, input().split())
c = 2 * k
ls = [input().split() for _ in range(c)]
i = 1
while i < c:
    l = [j for j in ls[i]]
    i += 1
print(n-len(sorted(l)))
N, K = map(int, input().split())

sunuke_list = []
for i in range(K):
    input()
    okashi_sunukes = map(int, input().split())
    for okashi_sunuke in okashi_sunukes:
        sunuke_list.insert(okashi_sunuke, '')

print(N - len(sunuke_list))
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-1):
    if i%2==1:
        d=sum(a[i-1])
        for n in range(d):
            sunuke.append(a[i][n])
sunuke=set(sunuke)
print(N-len(sunuke))
n,k = map(int,input().split())
count = []
for i in range(1,n+1):
    count.append(i)
    
for j 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())
string_list=[input() for i in range(2*K)]

print(N-K)
a,b = map(int, input().split())
s=[]
for _ in range(b-1):
 p=""
 r=""
 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())
d = [0]*k
a = [0]*k
s = []
for i in range(k):
    d[i] = int(input())
    a[i] = list(map(int,input().split()))
    s.extend(a[i])
d = set(s)

print(n-len(d))
print(s)
N,K = map(int,input().split())
A = []
for i in range(K):
    d = int(input())
    A.append(input())
print(N-len(set(A)))
n,k = list(map(int,input().split()))
s=set()
for i in range(k):
  s.add(int(input()))
  j=list(map(int,input().split()))
print(n-len(s))
from collections import defaultdict

N, K = list(map(int, input().split()))
d = {}
for i in range(1, N+1):
    d[i] = []
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)
N, K = list(map(int,input().split()))
d = [None for _ in range(K)]
C = []
count = [0 for _ in range(N)]
ans = 0
for i in range(K):
  d[i] = int(input())
  A = list(map(int,input().split()))
  for j in range(N):
    if j not in A:
      C.append(j)
C = [c for c in C if c != 0]
for i in range(1,N+1):
  for j in range(len(C)):
    if C[j] == i:
      count[i-1] += 1
for i in range(N):
  if count[i] == K:
    ans += 1
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()))
	if len(l)>0:
		s.add(a)
print(n-len(s))
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) != 0:
      ans[j] = 0
print(NK[1]-sum(ans))
n, k = map(int, input().split())
c = 2 * k
ls = [input().split() for _ in range(c)]
l = []
while c > 1:
    l = [j for j in ls[c-1]]
    c -= 1
print(n-len(sorted(l)))
n,k=map(int,input().split())
List=[]
for i in range(k):
    di=int(input())
    Li=input()
    List.append(Li)
s=set(List)
print(n-len(s))
n,k = map(int,input().split())
humans = [x+1 for x in range(n)]

for _ in range(k):
    d = int(input())
    l = list(map(int,input().split()))
    for i in humans:
        if i in l:
            humans.remove(i)
print(len(humans))
N,K=map(int,input().split())
res=[]
for i in range(K):
    d=input()
    ki=list(input())
    res=list(set(res)|set(ki))
res=[x for x in res if x!=' ']
print(N-len(res))
N,K = map(int, input().split())
d = [0] * K
A = []
Nlist = []
B = 0

for n in range(101):
    Nlist.append(0)


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

for l in range(N):
    if Nlist[l] == 0:
        B = B + 1

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

count=[0]*(n+1)

for i in range(k):
  d=int(input())
  a=list(map(int, input().split()))
  ans=0
  for i in range(len(a)):
    count[i]+=1
print(count.count(0))
import itertools
N,K = list(map(int, input().split(" ")))
A = list(itertools.chain.from_iterable([input().split(" ")  for i in range(K) if input().split(" ")]))
A = list(map(int, A))
none = [a for a in range(1, K + 1) if a not in A]
print(len(none))
nk = input().split()
NK =[int(x) for x in nk]
t = []
s = []
for l in range(1 ,NK[0]+1):
  s.append(l)
for i in range(1,NK[1]+1):
    d = int(input())
    A =  input().split()
    a = [int(x) for x in A]
    t += a
print(t)
set_t = set(t)
set_s = set(s)
r = set_s - set_t
print(len(r))
N,K=map(int,input().split())
A=[]
for i in range(K):
    d=int(input())
    A.append(input().split)
print(N-len(set(A)))
import sys
input = sys.stdin.readline

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

visited = [False] * N
for i in range(K):
    for j in range(d[i]):
        visited[j] = True

print(visited.count(False))
N, K = map(int, input().split())
table = [[int(i) for i in input().split()] for _ in range(K * 2)]

ans_list = []
sunuke_set = set(list(range(1, K + 1)))

for i in range(1, K * 2 + 1, 2):
    ans_list += table[i]

ans_set = set(ans_list)

print(len(sunuke_set - ans_set))
N, K = (int(num) for num in input().split(" "))
cnt = 0
dic = {i+1: 0 for i in range(N)}
print(dic)
while cnt < K:
    d = input()
    a = input().split(" ")
    for n in a:
        dic[int(n)] += 1
    cnt += 1

treated = 0
for key in dic:
    if dic[key] == 0:
        treated += 1
print(treated)
n,k = map(int,input().split())

d = [0 for i in range(k)]
a = [0 for i in range(k)]

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

l=[]
for c in range(len(a)):
    l.extend(a[c])
ls=list(set(l))
print(ls)
print(n-len(ls))
N,K = map(int, input().split())

dic = {}
for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for a in A:
        if not a in dic:
            dic[a] = 1

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

ans = set()
for _ in range(K):
    input()
    ans.add(map(int, input().split()))

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

okashi = [0 for _ in range(n)]

for i in range(k):
    d = int(input())
    lis = list(map(int,input().split()))
    for j in range(d):
        okashi[j-1] = 1
        
print(okashi.count(0))
n, k = map(int, input().split())
a = 0
li = []
for x in range(k):
    li.append(input().split())
    if n - k == 0:
        a = n - 1
    else:
        a = n - k
print(a)
n,k = map(int, input().split())
hito = []
for i in range(k):
  d = int(input())
  x = list(map(int, input().split()))
  for j in range(d):
    hito.append(x[j])
a = list(set(hito))
a.sort()
ans = n
for i in range(len(hito)):
  if i+1 in a:
    ans -= 1
print(ans)
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]))
  treated = list(set(treated) & set(tt))

print(len(treated))
N,K=map(int,input().split())
A=[]
people=list(range(1,N+1,1))
for idx in range(K):
    d=int(input())
    X=list((map(int,input().split())))
    for i in range(len(X)):
        A.append(X[i])
print(A)
print(people)
ans =[i for i in people if not i in A]
print(len(ans))
N, K = map(int, input().split())
d = int(input())

ls = list(range(1, N))
for i in range(K):
    for l in map(int, input().split()):
      #print(l)
      if l in ls:
      	ls.remove(l)

print(len(ls))
n, k = map(int,input().split())
d = []
a = []
for i in range(1,k+1):
    d.append(int(input()))
    a_temp = list(map(int,input().split()))
    a.append(a_temp)

num = []
    
for i in range(n):
    cnt = 0
    for j in range(k):
        if i in a[j]:
            cnt += 1
    if cnt == 0:
        num.append(i)
print(len(num))
N, K = map(int, input().split())
m = []
for i in range(K-1):
  di = int(input())
  A = [int(d) for d in input().split()]
  m = m + A
M = list(set(m))
print(N - len(M))
import itertools
n, k = map(int, input().split())
a = []
n= map(str, list(range(1,n+1)))
for num in range(k):
    d = int(input())
    a.append(list(input()))
#print(set(list(itertools.chain.from_iterable(a))))
#print(n,list(itertools.chain.from_iterable(a)))
#print(set(n)&set(itertools.chain.from_iterable(a)))

list1 = list(set(list(itertools.chain.from_iterable(a))))
list1.sort()
result =list(set(n)-set(list1))
print(len(result))
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))
n,k=map(int,input().split())
for w in range(k):
  d=int(input())
  a=list(map(int,input().split()))
l=[]
for x in range(1,n+1):
  l.append(x)
for y in range(k):
  for z in range(d):
    if a[z] in l:
      l.remove(a[z])
      y+=1
print(len(l))
n,k = (int(i) for i in input().split())
d = 0
a = []
c = set( [i for i in range(1,k+1)])
for i in range(k):
	d = int(input())
	a.extend(int(i) for i in (input().split()))

b = set(a)
d = c-b
print(len(d))

""""
n,m = (int(i) for i in input().split())
h = [int(i) for i in input().split()]
ab =[]
for i in range(m):
	ab.append(list(map(int,input().split())))
	"""
n, k = map(int, input().split())
d = []
a_list = []
for i in range(k):
    d = int(input())
    a_list.append(list(map(int, input().split())))

print(k - d)
import collections

n,k = map(int,input().split())
for i in range (k):
  d = int(input())
  a = map(int,input().split())
c = collections.Counter(a)
print(n-len(c))
N,K = map(int,input().split())
Data = [0]*N
print(K)
for k in range(K):
    _ = input()
    user = list(map(int,input().split()))
    for u in user:
        Data[u-1] += 1
ans = 0
for i in range(N):
    if Data[i] == 0:
        ans += 1
print(ans)
import sys
import math
import bisect

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 = int(input())

print(n - d)
n, k = map(int, input().split())
dl = ""

for i in range(k):
    d = int(input())
    dl += str(input().split())

cnt = 0
for i in range(n):
    if (dl.count(str(i+1)) == 0):
        cnt += 1

print(cnt)
N, K= map(int, input().split())
member = [1 for n in range(0, N)]

for i in range(1, K*2, 1):
  shuger = map(int, input().split())
  if i%2==0:
    for n in shuger:
      member[int(n)-1]=0
      #print(n-1)
print(member.count(1))
N, K = map(int, input().split())
d = int(input())
print(N-d)
n, k = map(int, input().split())
lst = []
count = 0
for i in range(k):
    d = int(input())
    a = input().split()
    lst.append(a)
for i in range(k):
    if str(i+1) not in lst[i]:
        count += 1
print(count)
N,K = map(int, input().split())
arr1=[]
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:
    for j in A:
      if j in arr1:
        arr1.remove(j)
print(len(arr1))
n,k = list(map(int,input().split()))
snukes = [0]*n
count = 0
for _ in range(k):
  d = int(input())
  temp = list(map(int,input().split()))
  for i in range(len(temp)):
    snukes[i]+=temp[i]
for i in snukes:
  if i==0:
    count+=1
print(count)
n, k = map(int, input().split())
a_list = [input().split() for i in range(1, 2*k+1)]
a = [e for row in a_list[1::2] for e in row]
n_list = list(range(1, n+1))
a_join = "".join(map(str, a))
ans = 0

for i in n_list:
    if str(i) in a_join:
        continue
    else:
        ans += 1

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


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

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


print(l[1:].count(1))
N,K=map(int,input().split())
ans={k:0 for k in range(1,N+1)}
for i in range(1,K+1):
    d=int(input())
    l=list(map(int,input().split()))
    for item in l:
        ans[item]=ans[item]+1 
for i in ans:
    if ans[i]==0:
        print(i)
N,K = map(int,input().split())
unchecked = set(list(range(1,N)))
checked = set()

for i in range(K):
  d = int(input())
  A = set(map(int,input().split()))
  checked = A | checked

unchecked = unchecked - checked
print(len(unchecked))
a,b = map(int, input().split())
s=[]
for _ in range(b-1):
 p=""
 r=""
 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)+1)
#整数の入力
N,K = map(int, input().split())

d_list = []
A_list_list = []
for i in range(K):
  #整数の入力
  d = int(input())
  d_list.append(d)
  #スペース区切りの整数の入力リスト
  A_list = list(map(int, input().split()))
  A_list_list.append(A_list)
  
counter = 0
for i in range(N):
  if((i+1 in A_list) ==True):
    counter = counter
  else:
    counter = counter + 1
print(counter)
n,k = map(int,input().split())
a = [0]*n
for _ in range(k):
    kind = int(input())
    for i in list(map(int,input().split())):
        a[i-1] += 1
print(a.count(0) if 0 not in a else 0)
N, K = map(int, input().split())

sunuke = [1] * N

for i in range(K):
    tmp = map(int, input().split())
    for t in tmp:
        sunuke[t-1] = 0
print(sum(sunuke))
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(list_A)

print(len(list_sunuke) - len(set_A))
n, k = map(int, input().split())
a = []
for i in range(1,k+1):
    d = int(input())
    if d == 1:
        a.append(int(input()))
    elif d >= 2 and d <= 100:
        a.append(map(int, input().split()))
    else:
        exit()

a = set(a)
print(n - len(a))
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
A = set(sum(num_list, []))
#print(A)

ppl = []
for i in range(N):
    ppl.append(N)
    N -= 1

people = set(ppl)
snack = set(A)

s_difference = people - snack
print(s_difference)
n,k=list(map(lambda x:int(x),input().split()))

a = [0] * n
print(a)
for w in range(k):
    d = int(input())
    ds = list(map(lambda x:int(x),input().split()))
    for i in ds:
        a[i-1] = 1

print(len(list(filter(lambda x:x==0,a))))
import collections
N,K = list(map(int,input().split()))

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

c = collections.Counter(sweets_snk)
len_C = len(c)
print(K - len_C)
def getN():
    return int(input())

def getIntList():
    return list(map(int, input().split()))


def main():

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

    slist = [0] * N

    for i in range(K):
        d = getN()
        A = getIntList()
        for j in range(d):
            slist[j] += 1
    
    print(slist.count(0))
    
    return

if __name__ == "__main__":
    main()
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 rest:
    if j in given:
      rest.remove(j)

print(len(rest))
n,k = map(int,input().split())
List = [list(map(int, input().split())) for i in range(2*k)]
List_a = []
for x in range(1,2*k,2):
    for i in List[x]:
        List_a.append(i)

List_a =set(List_a)
print(List_a)
print(n-len(List_a))
from collections import Counter as counter

ii = lambda:int(input())
mi = lambda:list(map(int,input().split()))
ix = lambda x:list(input() for _ in range(x))
mix = lambda x:list(mi() for _ in range(x))
iix = lambda x:list(int(input()) for _ in range(x))
##########

n,k = mi()
res = 0
a = []
for i in range(k):
    d = input()
    a.extend(mi())
c = counter(a)
for i in range(1,k+1):
    if c[i] == 0: res+=1
print(res)
n,k=map(int,input().split())
a=[]
for i in range(k):
 d=int(input())
 a.append([])
 a[i]=input().split()
count=0
for i in range(1,n+1):
 for j in range(k):
  if a[j].count(str(i))==0:
   count=count+1
   break
  break
print(count)
N,K = map(int,input().split())
d=[]
A=[]
for i in range(K):
    d.append(int(input()))
    if d[i]!=1:
        A.append(map(int,input().split()))
    else:
        A.append(int(input()))
answer = sum(d)-len(set(A))
print(answer)
N,K = map(int,input().split())
cnt = {num+1:0 for num in range(N)}
for i in range(K):
    d = int(input())
    num = list(map(int,input().split()))
    for j in range(d):
        cnt[num[j]]+=1
for k in range(len(cnt)):
    if cnt[k+1] == 0:
        print(k+1)
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[d-1]+=1
ans = 0
for i in range(N):
  if S[i]==0:
    ans+=1

print(ans)
N, K = map(int, input().split())
a = []
for i in range(K):
  di = int(input())
  a.append(map(int, input().split()))

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

a = []

for i in range(k):
    d = int(input())
    s = list(map(int, input().split()))
    for j in range(d):
        if s[j] in a:
            break
        else:
            a.append(s[j])

ans = n - len(a)

print(max(ans, 0))
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(N):
    if ANSlist[i] != 0:
        ANS += 1

print(ANS)