Problem:
 Score : 200 points    Problem Statement N  Snukes called Snuke 1 , Snuke 2 , ..., Snuke N live in a town.  There are K kinds of snacks sold in this town, called Snack 1 , Snack 2 , ..., Snack K . The following d_i Snukes have Snack i : Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}} .  Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?      Constraints  All values in input are integers.  1 \leq N \leq 100  1 \leq K \leq 100  1 \leq d_i \leq N  1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N         Input Input is given from Standard Input in the following format:  N  K  d_1  A_{1, 1} \cdots A_{1, d_1}  \vdots  d_K  A_{K, 1} \cdots A_{K, d_K}       Output Print the answer.        Sample Input 1 3 2
2
1 3
1
3      Sample Output 1 1   Snuke 1 has Snack 1 .  Snuke 2 has no snacks.  Snuke 3 has Snack 1 and 2 .   Thus, there will be one victim: Snuke 2 .       Sample Input 2 3 3
1
3
1
3
1
3      Sample Output 2 2

Solution (Python):
import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
from collections import deque
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def S(): return sys.stdin.readline().rstrip()
def LS(): return sys.stdin.readline().split()
def LS2(N): return [sys.stdin.readline().split() for i in range(N)]
def FILL(i,h): return [i for j in range(h)]
def FILL2(i,h,w): return [FILL(i,w) for j in range(h)]
def FILL3(i,h,w,d): return [FILL2(i,w,d) for j in range(h)]
def FILL4(i,h,w,d,d2): return [FILL3(i,w,d,d2) for j in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)

MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**5+10)


N,K = MI()
llist = [0]*N
for i in range(K):
    d = I()
    l = LI()
    for man in l:
        llist[man-1] += 1
print(llist.count(0))

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

ans = set(ans)

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

Solution (Python):
N,K =map(int,input().split())
ln =[0]*N
for i in range(K):
    d = int(input())
    l = list(map(int,input().split()))
    for j in range(d):
        ln[l[j]-1] += 1
print(ln.count(0))

Solution (Python):
n,k=map(int,input().split())
arr=[0 for i in range(n)]
for i in range(k):
    d=int(input())
    a=list(map(int,input().split()))
    for b in a:
        arr[b-1]+=1
cnt=0
for i in range(n):
    if arr[i]==0:
        cnt+=1
print(cnt)

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n, k = map(int, input().split())

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

    res = 0
    for i in sunuke:
        if i == 0:
            res += 1

    print(res)


if __name__ == '__main__':
    resolve()

Solution (Python):
N,K=map(int,input().split())
lst = list(range(1,N+1))
st =set()
for i in range(K):
    d = int(input())
    A = list(map(int,input().split()))
    st |= set(A)

num=0

for s in lst:
    if not s in st:
        num+=1

print(num)

Solution (Python):
N, K = map(int, input().split())

A = [list(map(int,input().split())) for _ in range(2*K)]

Pocession = [False for _ in range(N)]
for i, poc in enumerate(A):
    if i %2 == 1:
        for po in poc:
            Pocession[po-1] = True

print(Pocession.count(False))

Solution (Python):
a=input().split()
N=int(a[0])
K=int(a[1])
list1=[]
for i in range(K) :
  c=int(input())
  d=input().split()
  for item in d :
    list1.append(int(item))

m=len(list(set(list1)))
print(N-m)

Solution (Python):
import math
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n,k=INTM()
    d=[]
    a=set([])
    for i in range(k):
        d.append(INT())
        a=a | set(LIST())
    print(n-len(a))
    
    
if __name__ == '__main__':
    do()

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

hito = [1]*N
A = []
for num in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for num1 in range(d):
        idx = A[num1] - 1
        hito[idx] = 0

ans = sum(hito)
print(ans)

Solution (Python):
N,K=map(int,input().split())
have=[]
for i in range(K):
    D=int(input())
    a=list(map(int,input().split()))
    have +=a
print(N-len(set(have)))

Solution (Python):
N, K = map(int, input().split())
ans = [1] * N
for i in range(K):
  d = int(input())
  A = list(map(int, input().split()))
  for j in range(d):
    ans[A[j] - 1] = 0
print(sum(ans))

Solution (Python):
N,K = map(int,input().split())
dl = []
Al = []
for i in range(K):
    dl.append(int(input()))
    for j in list(map(int,input().split())):
        Al.append(j)

print(N-len(set(Al)))

Solution (Python):
N,K=map(int,input().split())
c=[]
for i in range(K):
  d=input()
  A=list(map(int,input().split()))
  for j in range(1,N+1):
    if j in A:
      c.append(j)
      
print(N-len(set(c)))

Solution (Python):
n, k = list(map(int, input().split()))

d = list()
s = set()
for _ in range(k):
    d = int(input())
    A = list(map(int, input().split()))
    for a in A:
        s.add(a)

c = 0
for i in range(1, n+1):
    if i not in s:
        c += 1

print(c)

Solution (Python):
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 A:
    sunuke[j-1] += 1

sum = 0
for i in range(N):
  if sunuke[i] == 0:
    sum += 1

print(sum)

Solution (Python):
from __future__ import print_function

import sys
sys.setrecursionlimit(500000)

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


















def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def main():
    n,k = map(int,input().strip().split())
    sunuke = [1 for i in range(n)]
    for i in range(k):
        x = int(input().strip())
        a = list(map(int, input().strip().split()))
        for j in a:
            sunuke[j-1] = 0
    print(sum([sunuke[i]==1 for i in range(n)]))


if __name__ == '__main__':
    main()

Solution (Python):
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right


from functools import reduce
from pprint import pprint

def myinput():
    return map(int,input().split())

def mylistinput(n):
    return [ list(myinput()) for _ in range(n) ]

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse_flag):
    data.sort(key=lambda x:x[col],reverse=reverse_flag)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

n,k = myinput()
d = []
A = []
for i in range(k):
    d.append( int(input()) )
    A.append(list(myinput()))



ls = [0]*n
for i in range(k):
    a = A[i]
    for j in range(len(a)):
        s = a[j] - 1
        ls[s] = 1

ans = n - sum(ls)
print(ans)

Solution (Python):
num_man, num_candy = map(int, input().split())

lis = [0]*num_man
for i in range(num_candy):
    sum = int(input())
    l_tmp = list(map(int, input().split()))
    for j in range(sum):
        lis[l_tmp[j]-1] = 1
ans = 0
for i in range(num_man):
    if(lis[i] == 0):
        ans += 1
print(ans)

Solution (Python):
n, k = map(int, input().split())
a = []

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


ans = 0

for i in range(1, n+1):
    for j in range(len(a)):
        if i in a[j]:
            break
    else:
        ans += 1

print(ans)

Solution (Python):
n,k = map(int, input().split())
s = set([i for i in range(1, n+1)])
for _ in range(k):
  input()
  s -= set(map(int, input().split()))
print(len(s))

Solution (Python):
N, K = map(int, input().split())
li = []
for i in range(1, N+1):
    li.append(i)
for i in range(K):
    s1 = input()
    s2 = list(map(int, input().split()))
    for j in s2:
        if j in li:
            li.remove(j)
print(len(li))

Solution (Python):


"""
import sys
input = sys.stdin.readline
import math
N = int(input())
n,m,q = map(int,input().split())
A = [list(map(int,input().split())) for i in range(q)]
"""

n,k = map(int,input().split())
A = [i for i in range(1,n+1)]
for j in range(k):
    s = int(input())
    K = list(map(int,input().split()))
    for i in range(s):
        if K[i] in A:
            A.remove(K[i])
print(len(A))

Solution (Python):
n, k = map(int, input().split())
s = set()
for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for j in a:
        s.add(j)

print(n-len(s))

Solution (Python):
N,K=map(int,input().split())
A=[]
d=[]
for _ in range(K):
    d.append(int(input()))
    A.append(list(map(int,input().split())))
A=sum(A,[])
print(N-len(set(A)))

Solution (Python):
def main():
    n,k = tuple([int(t)for t in input().split()])

    t = [0]*n
    for _ in range(k):
        input()
        k = tuple([int(t)-1 for t in input().split()])
        for k_i in k:
            t[k_i]+=1
    
    ans = 0
    for t_i in t:
        if t_i==0:
            ans+=1
    print(ans)

if __name__ == "__main__":
    main()

Solution (Python):
n,k=map(int,input().split())
a=[]
for i in range(k):
    d=int(input())
    a.extend(input().split())
print(n-len(set(a)))

Solution (Python):
n, k = map(int, input().split())
slist = [0]*n
for K in range(k):
  d = int(input())
  Alist = list(map(int, input().split()))
  for D in range(d):
    slist[Alist[D]-1] = 1
print(n-sum(slist))

Solution (Python):
N, K = map(int, input().split())
S = [0] * N
for _ in range(K):
  n = int(input())
  for a in [int(x) for x in input().split()]:
    S[a - 1] += 1
print(sum([1 for s in S if s == 0]))

Solution (Python):
N, K = map(int,input().split())

n_list = [0 for n in range(N)]
 
for k in range(K):
    d = int(input())
    d_list = map(int, input().split())
    for d in d_list:
        n_list[d-1] = 1
print(n_list.count(0))

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

Solution (Python):


ninzu, syurui = map(int, input().split())

shoji = [ 0 for _ in range(ninzu) ]

for _ in range(syurui):
    num = int(input())
    
    if num == 1:
        man = int(input())
        shoji[man-1] += 1
    else:
        mans = map(int, input().split())
        for man in mans:
            shoji[man-1] += 1

ans = 0
for sman in shoji:
    if sman == 0:
        ans += 1

print(ans)

Solution (Python):
N, K = [int(x) for x in input().split()]
d = [0] * K
A = [None for _ in range(K)]
for i in range(K):
    d[i] = int(input())
    A[i] = [int(x) for x in input().split()]

trick = [False] + [True] * (N)

for i in range(K):
    for a in A[i]:
        trick[a] = False

print(trick.count(True))

Solution (Python):
n,k=map(int,input().split())
ans=[1]*n
for i in range(k):
  d=int(input())
  a=list(map(int, input().split()))
  for j in a:
    if ans[j-1]==1:
      ans[j-1]-=1
print(sum(ans))

Solution (Python):
n, k = map(int, input().split())
p = list(range(1, n + 1))
for _ in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for i in a:
        if i in p:
            p.remove(i)
print(len(p))

Solution (Python):
n, k = [int(i) for i in input().split()]

having = set()
for _ in range(k):
    d = int(input())
    a = {int(i) for i in input().split()}

    having |= a
print(n - len(having))

Solution (Python):
N,K = list(map(int,input().split()))
ans =set()
for i in range(K):
    A = int(input())
    B = list(map(int,input().split()))
    for j in B:
        ans.add(j)
ans = len(ans)
print(N-ans)

Solution (Python):
n,k = map(int,input().split())
l = [0]*n


for i in range(k):
    for j in range(1):
        _ = input()
        tl = list(map(int,input().split()))
        for t in tl:
            l[t-1]+=1
        
ans = 0
for i in l:
    if i ==0:
        ans +=1

print(ans)

Solution (Python):
n, k = map(int, input().split())

ans = 0
check = [True for i in range(n)]

for i in range(k):
    d = int(input())
    tmp = list(map(int, input().split()))
    for ii in tmp:
        check[ii - 1] = False

for c in check:
    if c:
        ans += 1
print(ans)

Solution (Python):
N, K = map(int, input().split())
r = set([i for i in range(1, N + 1)])
for _ in range(K):
    input()
    r -= set(map(int, input().split()))

print(len(r))

Solution (Python):
N,K= [int(x) for x in input().split()]
count = [0] * (N+1)
for i in range(K):
    d = int(input())
    l = [int(x) for x in input().split()]
    for j in range(d):
        count[l[j]] = 1
print(count.count(0)-1)

Solution (Python):
n,k=map(int,input().split())
t=[0]*n
for i in range(k):
  a=int(input())
  b=list(map(int,input().split()))
  for j in range(a):
    c=b[j]-1
    t[c]+=1
count=0
for l in range(n):
  if t[l]==0:
    count+=1
print(count)

Solution (Python):
n, k = map(int, input().split())

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

cnt = 0
for m in range(len(mans)):
    if mans[m] == 0:
        cnt += 1

print(cnt)

Solution (Python):
N, K = map(int, input().split())
d = []
A = []
sunuke = [0] * N
for _ in range(K):
    d.append(int(input()))
    A.append(list(map(int, input().split())))
    for i in A[-1]:
        sunuke[i-1] += 1
print(len([i for i in sunuke if i == 0]))

Solution (Python):











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

treat = [0] * N

for k in range(K):
    input()
    P = [int(x) for x in input().split()]
    for p in P:
        treat[p-1] = 1

print(N-sum(treat))

Solution (Python):
n,k=list(map(int,input().split()))
sweets=[]
for i in range(k):
  d=int(input())
  sweets.extend(list(map(int,input().split())))
sweets=set(sweets)
print(n-len(sweets))

Solution (Python):
n,k=map(int,input().split())
snuke=[0]*n
for _ in range(k):
    d=int(input())
    a=list(map(int,input().split()))
    for i in a:
        i-=1
        snuke[i]+=1
ans=0
for i in snuke:
    if i==0:
        ans+=1
print(ans)

Solution (Python):
N,K=map(int,input().split())
A=set([i+1 for i in range(N)])
B=set()
for i in range(K):
  d=int(input())
  s=set(map(int,input().split()))
  B|=s
print(len(A-B))

Solution (Python):

from sys import stdin
import sys
sys.setrecursionlimit(10**8)

def nextLine(): return next(stdin)
def nextStrList(): return nextLine().split()
def nextIntList(): return [int(_) for _ in nextStrList()]


def ox(s, i):
	return s[i]=="o"


def main():
	n,k=nextIntList()

	s=set()
	for ki in range(k):
		d=nextIntList()[0]
		ai=nextIntList()

		s.update(ai)
	c=0
	for ni in range(1,n+1):
		if ni not in s:
			c+=1
	print(c)
	
	
if __name__=="__main__":
	main()

Solution (Python):
n, k = list(map(int,input().split()))
d = []
aa = []
a = []

answer = n

for i in range(k):
  d0 = int(input())
  d.append(d0)
  a = list(map(int,input().split()))
  aa.extend(a)
  
for i in range(n):
  if aa.count(i + 1) > 0:
    answer -= 1
    
print(answer)

Solution (Python):


import sys
readline = sys.stdin.readline
read = sys.stdin.read




n,k = [int(i) for i in readline().split()]

res = [0]*n
for i in range(k):
    d = input()
    d = [int(i) for i in readline().split()]
    for i in d:
        res[i-1] = 1

print(res.count(0))

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


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

print(N-len(have))

Solution (Python):
N,K=map(int,input().split())
ok = [0 for i in range(N)] 
for i in range(K):
  d = int(input())
  A = list(map(int, input().split()))
  for a in A:
    ok[a-1]+=1
ans = 0
for i in range(N):
  if ok[i] == 0:
    ans += 1
print(ans)

Solution (Python):
n,k=map(int,input().split())
l=[0]*n
for i in range(k):
  d=int(input())
  a=list(map(int,input().split()))
  for w in a:
    l[w-1]+=1
print(l.count(0))

Solution (Python):
N,K = map(int,input().split())
mochi = set([])
zenbu = set(list(range(1,N+1)))

for k in range(K):
    di = int(input())
    AAi = list(map(int,input().split()))
    for a in AAi:
        mochi.add(a)
        
print(len(zenbu - mochi))

Solution (Python):
N, K = map(int, input().split())
D = []
A = []
for _ in range(K):
    d = int(input())
    a = list(map(int, input().split()))
    
    D.append(d)
    A.append(a)

check = [False] * N
for a in A:
    for aa in a:
        if not check[aa - 1]:
            check[aa - 1] = True


print(N - sum(check))

Solution (Python):
N, K = map(int, input().split())
Trick = [1] * N
for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for j in A:
        if Trick[j-1] == 1:
            Trick[j-1] = 0

print(sum(Trick))

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

B=set(A)
count=0
for i in range(1,N+1):
  if i not in B:
    count+= 1

print(count)

Solution (Python):
n, k = map(int, input().split())

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

cnt = has_sweets.count(False)

print(cnt)

Solution (Python):
n, k = [int(x) for x in input().split()]

temp_list = [1] * (n + 1)
temp_list[0] = 0
for _ in range(k):
    d = int(input())
    a_list = [int(x) for x in input().split()]
    for a in a_list:
        temp_list[a] = 0
print(sum(temp_list))

Solution (Python):
N, K = map(int, input().split())

mp = {}
for i in range(1, N+1):
    mp[i] = 0
for _ in range(K):
    _ = int(input())
    A = list(map(int, input().split()))
    for a in A:
        mp[a] += 1
ans = 0
for i in mp.values():
    if i == 0:
        ans += 1
print(ans)

Solution (Python):
N,K = map(int,input().split())
L = [1]*N
for i in range(K):
    d = int(input())
    A = list(map(int,input().split()))
    for i in A:
        L[i-1] = 0
print(sum(L))

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

a=set(a)
cnt=0
for i in range(1,n+1):
  if i not in a:
    cnt+=1
print(cnt)

Solution (Python):
n,k = map(int,input().split())

n_li = [0]*n
for i in range(k):
    d = int(input())
    a_input = [int(i) for i in input().split()]
    for a in a_input:
        n_li[a-1]+=1

print(len([i for i in n_li if i==0]))

Solution (Python):
n, k = map(int, input().split())
snuke = set()

for _ in range(k):
    d = int(input())
    A = list(map(int, input().split()))
    snuke.update(set(A))

ans = n - len(snuke)
print(ans)

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

Solution (Python):

import numpy as np
from collections import deque
n, k = list(map(int, input().split()))
d = [0]*k
A = []
for i in range(k):
    d[i] = int(input())
    A.extend(list(map(int, input().split())))


print(n-len(set(A)))

Solution (Python):
import numpy as np
n,k = [int(i) for i in input().split()]

ans = np.array([0 for _ in range(n)])

for i in range(k):
    d = int(input())
    al = [int(i) -1 for i in input().split()]
    for j in al:
        ans[j] = 1 if ans[j] == 0 else ans[j]
        

print(n - np.count_nonzero(ans))

Solution (Python):
n, k = map(int, input().split())
lis = [False]*n
for _ in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for i in range(d):
        lis[a[i]-1] = True
ans = 0
for l in lis:
    if l == False:
        ans += 1
print(ans)

Solution (Python):
n, k = map(int, input().split())
has = [False for _ in range(n)]
for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for j in range(d):
        has[a[j] - 1] = True
count = 0
for i in range(n):
    if not has[i]:
        count += 1
print(count)

Solution (Python):
n,k=map(int,input().split())
a=set()
for _ in range(k):
  d=input()
  b=set(input().split())
  a=a.union(b)
print(n-len(a))

Solution (Python):
N,K = map(int, input().split())

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

for k in range(K):
    d = int(input())
    A = set(map(int, input().split()))
    for a in A:
        if a in S:
            S.remove(a)

print(len(S))

Solution (Python):
n,k = map(int,input().split())
p = []
for _ in range(k):
    d = int(input())
    a = list(map(int,input().split()))
    for i in range(d):
        if a[i] not in p:
            p.append(a[i])
print(n-len(p))

Solution (Python):
n, k = map(int, input().split())

cnt = [0] * n

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

print(cnt.count(0))

Solution (Python):
import numpy as np
n,k=list(map(int,input().split()))
t=np.zeros(n)
for i in range(k):
  d=int(input())
  tmp=list(map(int,input().split()))
  for j in range(d):
    t[tmp[j]-1] = 1

ans=n-np.sum(t)
print(int(ans))

Solution (Python):
def main():
    N,K=map(int,input().split())
    ans=[i for i in range(1,N+1)]
    for _ in range(K):
        d = int(input())
        A=[int(_) for _ in input().split()]
        for a in A:
            if a in ans:
                ans.remove(a)
    print(len(ans))

main()

Solution (Python):

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

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

snuke = [0] * (n+1)

for i in range(k):
    for j in range(d[i]):
        snuke[a[i][j]] += 1
ans = -1
for s in snuke:
    if s==0:
        ans += 1

print(ans)

Solution (Python):
n, k = map(int, input().split())
l = []
for _ in range(k):
    d = input()
    l.extend(input().split())
uni = set(l)
print(n - len(uni))

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

print(n-sum(ans))

Solution (Python):
N, K = map(int, input().split(' '))
A = []

for _ in range(K):
  D = int(input())
  A.extend(list(map(int, input().split(' '))))

print(N - len(set(A)))

Solution (Python):
n,k = map(int, input().split(' '))

res = set()
for i in range(k):
    d = int(input())
    a = list(map(int, input().split(' ')))
    for j in a:
        res.add(j)
print(n-len(res))

Solution (Python):
n,k = map(int, input().split())
sn = [0]*n
for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for j in range(d):
        sn[a[j]-1] = 1

count = 0
for i in range(n):
    if(sn[i] == 0):
        count += 1

print(count)

Solution (Python):
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

n,k = map(int,readline().split())
lst1 = [0]*n

for i in range(k):
    d = int(readline())
    lst2 = list(map(int,readline().split()))
    for j in lst2:
        lst1[j-1] += 1

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

print(ans)

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

sunuke = [0] * N
for i in range(K):
    for x in A[i]:
        sunuke[x-1] += 1

print(sunuke.count(0))

Solution (Python):

MOD = 10 ** 9 + 7
INFI = 10**10

import math

import itertools
import heapq


import copy
from functools import lru_cache

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default




def ret(a):
    c=[None]*(len(a)-1)
    if len(a)==1:
        return a[0]
    elif len(a)==0:
        return 0
    for i in range(1,len(a)):
        c[i-1]=abs(a[i]-a[i-1])
    return ret(c)


def main():
    n,k=map(int,input().split())
    mo=[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):
            mo[a[j]-1]=1
    print(len(mo)-sum(mo))





if __name__ == "__main__":

    main()

Solution (Python):
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()))

if __name__ == "__main__":
    n,k = I2()
    l = [1]*n
    for i in range(k):
        d = I()
        a = Intl()
        for i in a:
            l[i-1] = 0
    print(sum(l))

Solution (Python):
from itertools import chain


def flatten(list_of_lists):
    return chain.from_iterable(list_of_lists)


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

As = set(flatten(As))
print(N - len(As))

Solution (Python):
N,K = map(int,(input().split()))
d = [0]*K
a = [[] for _ in range(K)]
p = [0]*N
for i in range(K):
    d[i] == int(input())
    a[i] = list(map(int,(input().split())))
    for j in range(len(a[i])):
        p[a[i][j]-1] += 1
ans = 0
for i in range(N):
    if p[i] == 0:
        ans += 1

print(ans)

Solution (Python):
n,k = map(int,input().split())
sunuke = [i for i in range(n)]
for i in range(k):
  d = int(input())
  a_list = list(map(int,input().split()))
  for a in a_list:
    if a-1 in sunuke:
      sunuke.remove(a-1)
print(len(sunuke))

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

Solution (Python):
N, K = map( int, input().split() )

l = [0] * N
for _ in range(K):
  d = input()
  lists = map( int, input().split() )
  for j in lists:
    l[j-1] += 1
cnt = 0
for i in l:
  if i == 0:
    cnt += 1
print( cnt )

Solution (Python):
n,k = map(int,input().split())
ans = []
for i in range(k):
  d = int(input())
  A = list(map(int,input().split()))
  for j in range(len(A)):
    ans.append(A[j])
aaa = set(ans)
print(n-len(aaa))

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

ans = [0] * N
for i in range(K):
    for j in range(len(A[i])):
        ans[A[i][j] - 1] = 1

print(ans.count(0))

Solution (Python):
n, k = map(int, input().split())

all_group = set([i for i in range(1, n+1)])
has_group = set()
for i in range(k):
    d = input()
    a = set(list(map(int, input().split())))
    has_group |= a

print(len(all_group - has_group))

Solution (Python):
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[A[j]-1] = 1
ans = N - sum(sunuke)
print(ans)

Solution (Python):
N,K = map(int,input().split())
l = [0]*N
for _ in range(K):
  D = int(input())
  A = list(map(int,input().split()))
  for i in range(D):
    l[A[i]-1] = 1
count = 0
for i in range(N):
  if l[i] == 0:
    count += 1
print(count)

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

Solution (Python):

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


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


print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)


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


main()

Solution (Python):
import sys
import math
from collections import deque
import heapq
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N,K = IL()

used = [1]*N
for i in range(K):
  d = I()
  a = IL()
  for j in a:
    used[j-1] = 0

print(sum(used))

Solution (Python):
N, K = [int(x) for x in input().split()]
d = []
nums = [0 for i in range(N)]
for i in range(K):
    d = int(input())
    a = [int(x) for x in input().split()]
    for a_i in a:
        nums[a_i - 1] += 1

count = 0
for num in nums:
    if num == 0:
        count += 1
print(count)

Solution (Python):
N, K = map(int, input().split())

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

print(per.count(False))

Solution (Python):
n,k = map(int,input().split())
have = [0 for _ in range(n)]
for _ in range(k):
    d = int(input())
    A = list(map(int,input().split()))
    for a in A:
        have[a-1]=1
print(n-sum(have))