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):
n,k=[int(x) for x in input().split()]

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

Solution (Python):
from copy import copy, deepcopy
from collections import Counter
from math import sqrt, floor, factorial
from itertools import permutations, combinations, combinations_with_replacement
from operator import mul
from functools import reduce

MOD = 10**9 + 7
INF = float('inf')

N, K = list(map(int, input().split()))
ans = [0] * N

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

print(ans.count(0))

Solution (Python):
def main():
    n,k = map(int, input().split())
    s = set()
    for i in range(k):
        d = int(input())
        s = s | set(map(int, input().split()))
    ans = n - len(list(s))
    print(ans)

if __name__ == '__main__':
    main()

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

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

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


print(ans)

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

for i in range(K*2):
    if i % 2 == 0:
        d.append(int(input()))
    else:
        A.append(list(map(int, input().split())))

m = []
for n in range(1, N+1):
    m.append(n)

for a in A:
    for aa in a:
        if aa in m:
            m.remove(aa)

print(len(m))

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

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

for i in range(k):
    _ = input()
    sets |= set(map(int, input().split()))

m = set(range(1,n+1))
rest = m - sets
print(len(rest))

Solution (Python):
def main():
    n,k = map(int, input().split())
    array = []
    for i in range(k):
        _ = input()
        array.extend(map(int,input().split()))
    array = set(array)
    ans = 0
    for i in range(1,n+1):
        if i in array:
            continue
        else:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
n, k = map(int, input().split())
l = []
for i in range(k):
    d = int(input())
    a = input().split()
    for j in range(d):
        l.append(int(a[j]))
c = 0
for i in range(1, n + 1):
    if i not in l:
        c += 1
print(c)

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

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 j in A:
        l[j-1]=0
print(sum(l))

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

Solution (Python):
n, k = map(int, input().split())
sunuke = list()
cnt = 0
for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    sunuke.extend(a)
for j in range(1, n + 1):
    if j not in sunuke:
        cnt += 1
print(cnt)

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

ls = [0 for i in range(N+1)]
for i,a in enumerate(A):
  for j in range(d[i]):
    ls[a[j]]=1

cnt=0
for i in range(1,N+1):
  if ls[i] == 0:
    cnt+=1
print(cnt)

Solution (Python):
n,k=map(int,input().split())
snacks={}
for i in range(0,k):
  d=int(input())
  l=list(map(int,input().split()))
  for j in range(0,len(l)):
      snacks[l[j]]=1
count=0
for i in snacks.keys():
  count+=1
print(n-count)

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

Solution (Python):
n, k = map(int, input().split())
dict = {}
for _ in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    
    for i in a:
        
        if i in dict:
            dict[i] = dict[i] + 1
        else:
            dict[i] = 1


print(n - len(dict.keys()))

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

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

print(s.count(0))

Solution (Python):
from collections import Counter
N,K=map(int,input().split())
ans=[0]*N

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


ac = Counter(ans)

print(ac[0])

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

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

print(S.count(0))

Solution (Python):

def resolve():
    import sys
    input = sys.stdin.readline
    n, k = list(map(int, input().split()))

    has = set()

    for i in range(k):
        d = input().rstrip()
        x = list(map(int, input().split()))
        for a in x:
            has.add(a)

    count = 0
    for i in range(n):
        if i +1 not in has:
            count += 1
    print(count)



if __name__ == "__main__":
    resolve()

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

  s = set()

  for k in range(K):
    d = int(input())
    A = input().split()
    for i in range(d):
      s.add(A[i])
  
  print(N - len(s))



if __name__ == "__main__":
    main()

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

Solution (Python):
from collections import defaultdict as dd
n, k = map(int, input().split())
dic = dd(lambda: [])
for i in range(k):
    d = int(input())
    A = list(map(int, input().split()))
    for a in A:
        dic[a].append(i)



counter = 0
for i in range(1, n+1):
    if len(dic[i]) == 0:
        counter += 1
print(counter)

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

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 j in a:
        ans[j-1] += 1

print(ans.count(0))

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

for i in range(K):
    for j in range(d[i]):
        Sunuke[A[i][j]-1]+=1

ans = 0
for i in range(len(Sunuke)):
    if Sunuke[i] == 0:
        ans+=1

print(ans)

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

count = [0 for _ in range(N)]

for i in range(K):
    d = int(input())
    List = list(map(int, input().split()))
    for j in List:
        count[j - 1] += 1


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

print(ans)

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
cnt =0
for i in sn:
    if i==0:
        cnt+=1
print(cnt)

Solution (Python):

import heapq
from collections import defaultdict, deque
from math import ceil, factorial, gcd
from itertools import accumulate, permutations
import sys
import bisect


sys.setrecursionlimit(10 ** 7)
INF = float("inf")
MOD = 10 ** 9 + 7

si = lambda: input().strip()
ii = lambda: int(input())
mii = lambda: map(int, input().split())
msi = lambda: map(str, input().split())
lmii = lambda: list(map(int, input().split()))
lmsi = lambda: list(map(str, input().split()))
smii = lambda: sorted(map(int, input().split()))




N, K = mii()
snuke = set()
for i in range(K):
    d = ii()
    A = lmii()
    for a in A:
        snuke.add(a)
ans = 0
for i in range(1, N+1):
    if i not in snuke:
        ans += 1
print(ans)

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

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

print(sunu.count(0) - 1)

Solution (Python):
n,k=map(int,input().split())
hoge=[0 for i in range(n)]
for i in range(k):
  aaa=int(input())
  huga=list(map(int,input().split()))
  for j in range(len(huga)):
    hoge[huga[j]-1]+=1
ans=0
for i in range(n):
  if(hoge[i]==0):
    ans+=1
print(ans)

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

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

x=[0]*n

for _ in range(0,k):
  d=input()
  a=list(map(int,input().split()))
  for i in a:
    x[i-1]+=1
print(x.count(0))

Solution (Python):
N, K = tuple(int(c) for c in input().split(' '))
d = []
have = set()
for _ in range(K):
    d.append(int(input()))
    A = [int(c) for c in input().split(' ')]
    for a in A:
        have.add(a)

print(N - len(have))

Solution (Python):
n, k = map(int, input().split())
ls = list(range(1, n + 1))

for i in range(k):
    d = int(input())
    ls2 = list(map(int, input().split()))
    for j in range(d):
        if ls2[j] in ls:
            ls.remove(ls2[j])

print(len(ls))

Solution (Python):
mNK = map(int, input().split())
lNK = list(mNK)

lSnk = [1 for i in range(lNK[0])]

for i in range(lNK[1]):
    d = int(input())
    mSwt = map(int, input().split())
    lSwt = list(mSwt)
    for s in lSwt:
        lSnk[s - 1] = 0

ans = sum(lSnk)
print(ans)

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

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

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

ans = 0
for su in sunuke:
    if su == 0:
        ans += 1

print(ans)

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

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

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

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

L = []
for count in range(N):
    L.append(0)

for count in range(K):
    d = int(input())
    Alist = list(map(int,input().split()))
    for count2 in range(len(Alist)):
        L[Alist[count2]-1] = 1

ans = 0
for count in range(N):
    if L[count] == 0:
        ans = ans + 1

print(ans)

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

hoge = [0] * N

for a in A:
    for v in a:
        hoge[v-1] += 1

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

print(ans)

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

sweets = []

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

print(N - len(set(sweets)))

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

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

Solution (Python):


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

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

print(inv.count(0))

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

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

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

print(ans)

Solution (Python):
n, k = (int(each) for each in input().split())
snuke = set(range(1, n+1))
for d in range(k):
    d = int(input())
    l = set([int(each) for each in input().split()])
    snuke -= l

print(len(snuke))

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

Solution (Python):
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[A[j]-1]+=1
    
ans = 0
for i in range(N):
  if S[i]==0:
    ans+=1
    
print(ans)

Solution (Python):

import math
from collections import Counter
n,k=map(int,input().split())
di={}
for i in range(k):
	d=int(input())
	l=[int(x) for x in input().split()]
	for j in l:
		if j not in di:
			di[j]=1
		else:
			di[j]+=1
c=0
for i in range(1,n+1):
	if i not in di:
		c+=1
print(c)

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

Solution (Python):
n,k = map(int,input().split())
List = [False for i in range(n)]
for i in range(k):
    d = int(input())
    tmp = [int(i) for i in input().split()]
    for i in tmp:
        List[i-1] = True
ans = 0
for i in range(n):
    if List[i]==False:
        ans += 1
print(ans)

Solution (Python):


[n, k] = map(int, input().split())
d = [0 for x in range(k)]
a = [[] for x in range(k)]

for i in range(k):
    d[i] = int(input())
    a[i] = set([int(x) for x in input().split()])

org = set([x + 1 for x in range(n)])
uniq = set()
for s in a:
    uniq = uniq | s

print(len(org - uniq))

Solution (Python):
N,K=list(map(int,input().split()))
d_list=[]
num_list=[]
for i in range(K):
  d_list.append(int(input()))
  num_list.extend(list(map(int,input().split())))
print(N-len(set(num_list)))

Solution (Python):
import numpy as np
N, K = map(int, input().split())
A = np.zeros(N)
for i in range(K):
    d = int(input())
    tmp = list(map(int, input().split()))
    for j in range(d):
        A[tmp[j]-1] += 1
print(np.sum((A==0)))

Solution (Python):
N, K = list(map(int, input().split()))
cnt = {i: 0 for i in range(1, N+1)}
for _ in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for a in A:
        cnt[a] += 1
res = len([k for k, v in cnt.items() if v == 0])
print(res)

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

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

Solution (Python):
def Main(N, K, d, A):
    se = set()
    for a in A:
        se.update(a)
    return N - len(se)
        
def main():
    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(Main(N, K, d, A))

if __name__ == '__main__':
    main()

Solution (Python):
n, k = map(int, input().split())
a = [0 for _ in range(n)]

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

cnt = 0
for k in a:
  if k == 0:
    cnt += 1

print(cnt)

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

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

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

for i in range(k):
  a = input()
  bs = input().split()
  for b in bs:
    s.add(b)

print(n - len(s))

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

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

print(N - len(d))

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

Solution (Python):
n, k = map(int, input().split())
ans = []
for i in range(n): ans.append(0)

for i in range(k):
  no = int(input())
  a = list(map(int, input().split()))
  for j in a:
    
    ans[j-1] = 1
tmp = 0
for i in ans:
  if(i==0):tmp+=1
print(tmp)

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

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

count = 0
for i in range(n):
    if i + 1 in set(lst):
        count += 1

print(n - count)

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

print(n - len(t))

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

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())))
n_list=[]
for i in range(1,n+1):
    n_list.append(i)
count=[1]*n
for i in range(len(a)):
    for j in range(len(a[i])):
        count[a[i][j]-1]=0
sum=0
for l in count:
    sum+=l
print(sum)

Solution (Python):
N, K = map(int, input().split())
s = set()
for _ in range(K):
    input()
    for i in map(int, input().split()):
        s.add(i)
print(N - len(s))

Solution (Python):
n,k=map(int,input().split())
item=[0 for _ in range(n)] 
for i in range(k):
    i_d=int(input())
    a_i=list(map(int,input().split()))
    for j in a_i:
        item[j-1]=1
counter=0
for i in range(n):
    if item[i-1]==0:
        counter+=1
print(counter)

Solution (Python):
conditions = input().split(' ')
n = int(conditions[0])
k = int(conditions[1])

counts = []
datas = []
for i in range(k):
    counts.append(int(input()))
    datas.append(input().split(' '))
    datas[i] = [int(x) for x in datas[i]]

s = set()
for i in range(n):
    s.add(i+1)

for d in datas:
    ss = set(d)
    s -= ss

print(len(s))

Solution (Python):
N, K = list(map(int, input().split()))
all_n = set(range(1, N+1))
for i in range(K):
    d = int(input())
    As = set(map(int, input().split()))
    all_n = all_n - As
print(len(all_n))

Solution (Python):
N, K = map(int, input().split())
sunuke_list = [False for n in range(N)]

for k in range(K):
    d = int(input()) 
    kasi = list(map(int, input().split()))
    
    for j in kasi:
        sunuke_list[j-1] = True

print(N-sum(sunuke_list))

Solution (Python):
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product, combinations_with_replacement
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def S(): return input()


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


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def debug(table, *args):
    ret = []
    for name, val in table.items():
        if val in args:
            ret.append('{}: {}'.format(name, val))
    print(' | '.join(ret), file=sys.stderr)


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']

show_flg = False



def main():
    N, K = MI()
    d = []
    A = [None for i in range(K)]
    AD = [set() for i in range(N)]

    for i in range(K):
        d = I()
        A[i] = LI()

    for i in range(K):
        for k in A[i]:
            AD[k-1].add(i+1)

    ans = 0
    for i in range(len(AD)):
        if len(AD[i]) == 0:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
N,K=map(int,input().split())
s = set()
for i in range(K):
  d = input()
  l=set(map(int,input().split()))
  s |= l
print(N-len(s))

Solution (Python):

N, K = map(int, input().split())
a = []
for i in range(K):
    d = int(input())
    a += list(map(int, input().split()))
a = set(a)
b = set(i for i in range(1, N+1))

print(len(a ^ b))

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

dlist = []
alist = []

for i in range(k):
  dlist.append(int(input()))
  alist += (list(map(int,input().split())))

ans = len(set(range(1,n+1)) - set(alist))

print(ans)

Solution (Python):
N, K = map(int, input().split())
d=[]
AA=[]
for i in range(K):
  di = int(input())
  A = list(map(int, input().split()))
  AA = AA + A
Aset = set(AA)
ans = N - len(Aset)
print(ans)

Solution (Python):
n, k = map(int, input().split())
L = [0] * n
for i in range(k):
    d = int(input())
    tmp = list(map(int, input().split()))

    for j in range(len(tmp)):
        if L[tmp[j] - 1] == 0:
            L[tmp[j] - 1] = 1

print(L.count(0))

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

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

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

print(c.count(0))

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

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

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

	for j in range(in_dk):
		treat_l[in_t_list[j]-1] += 1


cnt = 0
for i in treat_l:
	if(i == 0):
		cnt += 1
print(cnt)

Solution (Python):
import sys
input=sys.stdin.readline

N,K=(int(x) for x in input().rstrip('\n').split())
snuke=set()
for i in range(K):
  d = int(input().rstrip('\n'))
  snuke = snuke | set((int(x) for x in input().rstrip('\n').split()))
print(N-len(snuke))

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

for _ in range(k):
  d=int(input())
  a=list(map(int,input().split()))
  
  for i in a:
    li[i-1]+=1
    
print(li.count(0))

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

l = [list(map(int,input().split())) for i in range(k*2)]

a = [[] for i in range(n)]

for i in range(0,k*2,2):
    n = l[i]
    for j in l[i+1]:
        a[j-1].append(i+1)


cnt = 0

for i in a:
    if len(i) == 0:
        cnt += 1

print(cnt)

Solution (Python):
N, K = [int(el) for el in input().split()]
snukes = set(range(1, N + 1))
snacks = set()
for _ in range(K):
    _ = input()
    arr = [int(el) for el in input().split()]
    snacks.update(arr)
print(N - len(snukes.intersection(snacks)))

Solution (Python):

from collections import deque
from operator import itemgetter
from bisect import bisect_left, bisect
import itertools
import sys
import math
import numpy as np
import time
sys.setrecursionlimit(10**6)
input = sys.stdin.readline


def main():
    n, k = map(int, input().split())
    snack = [0]*n
    for i in range(k):
        d = int(input())
        a = [int(x) for x in input().split()]
        for j in range(d):

            snack[a[j] - 1] += 1
    print(snack.count(0))


if __name__ == '__main__':
    main()

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

Solution (Python):
N, K = [int(i) for i in input().split()]
nusuke = set(range(1, N + 1))
nusuke_with_treats = set()

for _ in range(K):
    input()
    for i in input().split():
        nusuke_with_treats.add(int(i))

print(len(nusuke - nusuke_with_treats))

Solution (Python):
n,k=map(int,input().split())
s=[]
for i in range(0,k):
    d=int(input())
    a=input().split()
    for j in range(0,d):
        s.append(a[j])

ans=n-len(set(s))
print(ans)

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

Solution (Python):
n,k = map(int,input().split())
sunuke = [0]*n
for i in range(k):
    dum = input()
    sunuke_list = list(map(int,input().split()))
    for i in sunuke_list:
        sunuke[i-1] = 1
count = 0
for i in range(n):
    if sunuke[i] != 1:
        count += 1
print(count)

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

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

d = list(set(d))
print(n-len(d))

Solution (Python):
N,K = list(map(int,input().split()))
cnt = 0
a = [True for i in range(N)]
for i in range(K):
    b = input()
    c = list(map(int,input().split()))
    for j in c:
        a[j-1] = False
for i in range(len(a)):
    if a[i]:
        cnt+=1
print(cnt)

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

li=[list(map(int,input().split())) for i in range(k*2)]
ans=[]
for j in range(1,len(li),2):
    ans+= li[j]
ans = set(ans)

print(n-len(ans))

Solution (Python):
if __name__ == "__main__":
    
    
    
    
    
    
    N, K = map(int, input().split())
    s = set()
    for k in range(K):
        d = int(input())
        line = list(map(int, input().rstrip().split(' ')))
        for l in line:
            s.add(l)
    print(N-len(s))

Solution (Python):
import sys
from io import StringIO
import unittest


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

    ans = []

    for i in range(2 * k):
        if i % 2 == 1:
            tmp = list(map(int, input().split()))
            ans.append(tmp)
        else:
            hoge = input()

    ans = [i for a in ans for i in a]
    print(n - len(set(ans)))


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """3 2
2
1 3
1
3"""
        output = """1"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """3 3
1
3
1
3
1
3"""
        output = """2"""
        self.assertIO(input, output)

if __name__ == "__main__":
    
    resolve()

Solution (Python):
n,k = map(int,input().split())
dic = {}
for i in range(1,n+1):
    dic[i] = 0
for j in range(1,k+1):
    d = int(input())
    lis1 = list(map(int,input().split()))
    for i in lis1:
        dic[i] += 1
lis = [i for i in dic.values()]

print(lis.count(0))

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

Solution (Python):
n,k=map(int,input().split())
nums=[0 for _ in range(n)]
for _ in range(k):
  input()
  aas=list(map(int,input().split()))
  for aa in aas:
    nums[aa-1]+=1
print(sum(num==0 for num in nums))

Solution (Python):
n,k = [int(e) for e in input().split()]
d = [0]*k
a = [0]*k
for i in range(k):
    d[i]=int(input())
    a[i]=[int(e) for e in input().split()]
s = set()
for i in range(k):
    for j in range(d[i]):
        s.add(a[i][j])
print(n-len(s))

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

A = set()

for _ in range(k):
  d = int(input())
  A |= set(input().split())
  
print(n-len(A))

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 j in a:
        l[j-1] += 1

print(l.count(0))

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

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

ANS = [False] * N

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

print(ANS.count(False))

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