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):



from math import *
from copy import *					
from heapq import *					
from string import *				
from random import *				
from bisect import *				
from sys import stdin				
from sys import maxsize				
from operator import *				
from itertools import *				
from collections import Counter		
from collections import defaultdict 

'''

'''

def solve(l):
	n = len(l)
	

N,K = list(map(int, stdin.readline().rstrip().split()))
ans = 0
d = {}
for kk in range(K):
	dd = int(input())
	l = list(map(int, stdin.readline().rstrip().split()))
	for i in l:
		d[i] = 1
for i in range(1,N+1):
	if(i not in d):
		ans += 1

print(ans)

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

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

Solution (Python):
import numpy as np

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

people = [0] * n

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

people = np.array(people)
a = np.count_nonzero(people)
print(n - a)

Solution (Python):




def main():
    N,K = map(int,input().split())
    treats = [0] * N
    for i in range(K):
        d = int(input())
        A = list(map(int,input().split()))
        for j in range(d):
            treats[A[j]-1] +=1
    def isZero(i):
        return i == 0
    print(len(list(filter(isZero,treats))))
    
    pass

if __name__ == '__main__':
    main()

Solution (Python):
import math
N,K= map(int, input().split())
okasizu = [0] * (N + 1)
for _ in range(K):
    d = int(input())
    nums = list(map(int, input().split()))
    for num in nums:
        okasizu[num] += 1
ans = 0
for i in range(1,N + 1):
    if okasizu[i] == 0:
        ans += 1
print(ans)

Solution (Python):
N, K = list(map(int, input().split()))
B = [0]*N
for _ in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for one in A:
        B[one-1]+=1
cnt = 0
for one in B:
    if one==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 a:
    ans.append(j)
ans=set(ans)

print(n-len(ans))

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

for _ in range(k):
    d = int(input())
    al = list(map(int, input().split()))
    for a in al:
        l[a-1] += 1

print(l.count(0))

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


if __name__ == '__main__':
    resolve()

Solution (Python):
N,K=list(map(int,input().split()))
child=[False] * N
for _ in range(K):
    d=int(input())
    ppp = list(map(int,input().split()))
    for p in ppp:
        child[p-1]=True
ans = 0
for t in child:
    if not t:
        ans += 1
print(ans)

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

Solution (Python):

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

okasi = [1 for i in range(N)]

for i in range(K):
  d = int(input())
  list_okasi = list(map(int, input().split()))
  for sunuke in list_okasi:
    okasi[sunuke-1] = 0
    
print(sum(okasi))

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

T = [0] * N

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

print(T.count(0))

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

ans = snuke.count(0)

print(ans)

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

print(sum(ans))

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

Solution (Python):
import math
import fractions
import collections
import itertools
N,K=map(int,input().split())
snu=[0]*N
for i in range(K):
    d=int(input())
    l=list(map(int,input().split()))
    for i in range(d):
        snu[l[i]-1]=snu[l[i]-1]+1

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

Solution (Python):

import sys
input = sys.stdin.readline

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

print(sum(ans))

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

for i in range(K):
  D = int(input())
  B = list(map(int, input().split()))
  for j in range(D):
    A[B[j] - 1] += 1
    
print(A.count(0))

Solution (Python):
n, k = map(int, input().split())
res_list = []
for i in range(k):
    di = int(input())
    a = [int(x) for x in input().split()]
    for aidi in a:
        if not aidi in res_list:
            res_list.append(aidi)

res = n
for i in range(1, n+1):
    if i in res_list:
       res -= 1
print(res)

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

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

aa = [1]*n

for i in range(k):

    d = int(input())
    a = list( map(int, input().split()))
    for a_ in a:
        aa[a_-1]=0

print(sum(aa))

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

Solution (Python):

import sys

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

if __name__ == '__main__':
    main()

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

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

unique = set()
for i in range(k):
    d = int(input())
    A = list(map(int, input().split()))

    for a in A:
        unique.add(a)

print(n-len(unique))

Solution (Python):
import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from math import factorial, sqrt, ceil, gcd
from functools import lru_cache, reduce
INF = 1 << 60
MOD = 1000000007
sys.setrecursionlimit(10 ** 7)


class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


def dijkstra_heap(s, edge, n):
    
    d = [10**20] * n
    used = [True] * n 
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr


def lcm(x, y):
    return (x * y) // gcd(x, y)


def lcm_list(numbers):
    return reduce(lcm, numbers, 1)


def gcd_list(numbers):
    return reduce(gcd, numbers)


def is_prime(n):
    if n <= 1:
        return False
    p = 2
    while True:
        if p ** 2 > n:
            break
        if n % p == 0:
            return False
        p += 1
    return True



def eratosthenes(limit):
    A = [i for i in range(2, limit+1)]
    P = []

    while True:
        prime = min(A)
        
        if prime > sqrt(limit):
            break
            
        P.append(prime)
            
        i = 0
        while i < len(A):
            if A[i] % prime == 0:
                A.pop(i)
                continue
            i += 1
            
    for a in A:
        P.append(a)
            
    return P


def permutation_with_duplicates(L):

    if L == []:
        return [[]]

    else:
        ret = []

        
        S = sorted(set(L))

        for i in S:

            data = L[:]
            data.remove(i)

            for j in permutation_with_duplicates(data):
                ret.append([i] + j)

        return ret



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

Solution (Python):
N, K = map(int, input().split())
sunuke = {i for i in range(1, N+1)}

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

print(len(sunuke))

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

result=set([])

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

    for aa in a:
        result.add(aa)

print(n-len(list(result)))

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()


def main():
    N, K = map(int, input().split())
    D = set([i for i in range(1, N + 1)])
    for _ in range(K):
        _ = int(input())
        A = list(map(int, input().split()))
        for a in A:
            D.discard(a)
    print(len(D))
    


if __name__ == "__main__":
    main()

Solution (Python):
N, K = [int(_n) for _n in input().split()]
li = [0]*N
for i in range(K):
    input()
    A = [int(_n)-1 for _n in input().split()]
    for a in A:
        li[a]+=1
res = 0
for l in li:
    if l == 0:
        res += 1
print(res)

Solution (Python):

import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, K = lr()
x = [True] * (N+1)  
for i in range(K):
    d = ir()
    A = lr()
    for a in A:
        x[a] = False

answer = sum(x) - 1
print(answer)

Solution (Python):
N, K = list(map(int, input().split(' ')))
dict_ = {}

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

print(N - len(dict_))

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

snukes = set(range(1, N+1))

for _ in range(K):
    d = input()
    snukes -= set(map(int, input().split()))

print(len(snukes))

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

s = set()

for k in range(k):
  k = input()
  a = list(map(int,input().split()))
  
  s |= set(a)
  
print(n - len(s))

Solution (Python):
n, k = map(int, input().split())
okasi = [1 for i in range(n)]
for i in range(k):
    di = int(input())
    ai = list(map(int, input().split()))
    for j in ai:
        okasi[j-1] = 0
print(sum(okasi))

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

Solution (Python):
N,K=map(int,input().split())
D=[]
A=[]
for i in range(K):
    D.append(int(input()))
    A+=list(map(int,input().split()))
A=list(set(A))
A.sort()
ans=0
for i in range(1,N+1):
    if i not in A:
        ans+=1
print(ans)

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

print(sunuke.count(0))

Solution (Python):
import sys
sys.setrecursionlimit(700000)

def s_in():
    return input()

def n_in():
    return int(input())

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

n,k=l_in()

s = set(range(n))

for _ in range(k):
    d = n_in()
    A = l_in()
    for a in A:
        if a-1 in s:
            s.remove(a-1)

print(len(s))

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

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

have = [False for _ in range(n)]
for _ in range(k):
    d = int(input())
    for a in map(int, input().split()):
        have[a - 1] = True

answer = n - sum(map(int, have))
print(answer)

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

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

print(N-sum(okashi))

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

Solution (Python):
from collections import defaultdict, Counter, namedtuple, deque
import itertools
import functools
import bisect
import heapq
import math


NN = 202020
MOD = 10**9+7

INF = float("inf")

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

print(sum(kashi))

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:
        l.append(j)
print(n - len(set(l)))

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

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

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

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

ans = 0

for l in lis:
    if l == 0:
        ans += 1

print(ans)

Solution (Python):
N, K = map(int, input().split())
cand = {i for i in range(1, N+1)}
for _ in range(K):
    d = int(input())
    *A, = map(int, input().split())
    cand -= set(A)
print(len(cand))

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


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

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

    ans = tmp.count(0)
    print(ans)


if __name__ == "__main__":
    main()

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

for i in range(K):
    d = int(input())
    A = [int(i) for i in input().split()]
    for j in A:
        sunukes[j-1] = True
    
ans = 0
for i in sunukes:
    if not i:
        ans += 1
print(ans)

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

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

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

Solution (Python):
import sys
sys.setrecursionlimit(10**8)
def ii(): 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 dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]





N, K = mi()

flag = [0]*N

for i in range(K):
    n = ii()
    A = li()
    for num in A:
        flag[num-1] += 1

cnt = 0
for i in flag:
    if not i:
        cnt += 1

print(cnt)

Solution (Python):
import bisect
N, K = map(int, input().split())
D = [0]*N
for i in range(K):
    d = int(input())
    for x in input().split():
        x = int(x)
        x -= 1
        D[x] += 1

D.sort()
print(bisect.bisect_left(D, 1))

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

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

A = list(set(A))

print(N-len(A))

Solution (Python):
import numpy as np
N, K = map(int, input().split())
ans = [0 for _ in range(N)]
for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for a in A:
        ans[a - 1] = 1
print(N - np.count_nonzero(np.array(ans)))

Solution (Python):
import itertools

n, k = map(int,input().split())
li = []

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

li = list(itertools.chain.from_iterable(li))
li = set(li)

print(n-len(li))

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

print(num)

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

print(L.count(0))

Solution (Python):
def examA():
    S = SI()
    if S=="ARC":
        ans = "ABC"
    else:
        ans = "ARC"
    print(ans)
    return

def examB():
    N, K = LI()
    snuke = set(range(1,N+1))
    for _ in range(K):
        d = I()
        A = LI()
        for a in A:
            snuke.discard(a)
    ans = len(snuke)
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(readline())
def LI(): return list(map(int,readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examB()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Solution (Python):
def main():
    n,k = map(int,input().split())
    b = set()
    for i in range(k):
        d = int(input())
        a = list(map(int,input().split()))
        b |= set(a)
    print(n-len(b))
    
if __name__ == '__main__':
    main()

Solution (Python):
N,K=map(int,input().split())
t=set()
for _ in range(K):
    D=int(input())
    A=list(map(int,input().split()))
    for i in A:
        t.add(i)
ans=0
for i in range(1,N+1):
    if i not in t:
        ans+=1
print(ans)

Solution (Python):
N, K = map(int, input().split())
S = set()
for _ in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for a in A:
        S.add(a)
print(N - len(S))

Solution (Python):
import sys
sys.setrecursionlimit(10**6) 
import math
from copy import copy, deepcopy
from operator import itemgetter

from bisect import bisect_left, bisect, bisect_right

from collections import deque 



from collections import Counter

from itertools import accumulate

from heapq import heapify,heappop,heappush


def input(): return sys.stdin.readline()[:-1]
def printl(li): print(*li, sep="\n")
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds





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




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

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

L = [1]*N
for a in A:
    for i in a:
        L[i-1] = 0
print(sum(L))

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

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

Solution (Python):

N,K=map(int,input().split())
okashi=[1 for i in range(N)]

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

print(sum(okashi))

Solution (Python):

from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n,k = LI()
    d = [0]*n
    for _ in range(k):
        __ = input()
        a = LI()
        for i in a:
            d[i-1] = 1
    print(n-sum(d))
    return


if __name__ == "__main__":
    solve()

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

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())
ans=[]
for i in range(K):
    d=int(input())
    A=list(map(int,input().split()))
    ans.extend(A)
ans=set(ans)
count=len(ans)
print(N-count)

Solution (Python):
N,K=map(int, input().split())
A=[]
for _ in range(K):
    input()
    A+=list(map(int, input().split()))
from collections import Counter
C=Counter(A)
print(N-sum(i in C for i in range(1,N+1)))

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

cnt = [0] * (n + 1)

for _ in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for e in a:
        cnt[e] = 1

ans = cnt[1:].count(0)
print(ans)

Solution (Python):
N,K = list(map(int,input().split()))
lst = [0]*N
for i in range(K):
    d = int(input())
    for Ai in list(map(int,input().split())):
        lst[Ai-1] += 1

ans = 0
for num in lst:
    if num == 0:
        ans += 1
print(ans)

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

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

print(cnt)

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

snuke=[1 for i in range(n)]
for i in range(k):
    d=int(input())
    A=[int(i) for i in input().split()]
    for ele in A:
        snuke[ele-1]*=0
print(sum(snuke))

Solution (Python):




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

    motteru = [False] * N

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

    print(motteru.count(False))


if __name__ == '__main__':
    main()

Solution (Python):


import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N, K = MAP()
S = set()
for i in range(K):
    INT()
    S |= set(LIST())
ans = N - len(S)
print(ans)

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

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, K = MAP()
A = [True] * N
for i in range(K):
    d = INT()
    B = LIST()
    for b in B:
        A[b-1] = False
print(sum(A))

Solution (Python):
N, K = [int(i) for i in input().split()]
S = {i for i in range(1, N+1)}

for i in range(K):
    d = int(input())
    A = set([int(i) for i in input().split()])
    S = S - (S & A)

print(len(S))

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

if __name__ == "__main__":
    main()

Solution (Python):




def main():
  N, K = map(int, input().split())
  counts = [0] * N

  for _ in range(K):
    input()
    for n in map(int, input().split()):
      counts[n - 1] = 1

  print(len([v for v in counts if v == 0]))


if __name__ == '__main__':
  main()

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

sunukes = [0] * N

for _ in range(K):
    di = int(input())
    Ai = list(map(int, input().split()))
    for item in Ai:
        sunukes[item-1] += 1

ans = 0

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

print(ans)

Solution (Python):
def main():
    N, K = (int(i) for i in input().split())
    F = [True]*N
    for _ in range(K):
        d = int(input())
        A = [int(i) for i in input().split()]
        for a in A:
            F[a-1] = False
            
    ans = 0
    for f in F:
        if f:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
n, k = map(int, input().split())
a = set({})
for _ in range(k):
    p = int(input())
    f = [int(i) for i in input().split()]
    a = a | set(f)
print(n - len(a))

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

print(l.count(0))

Solution (Python):
n, k = map(int, input().split())
no = [True] * n
for _ in range(k):
    _ = input()
    a = map(int, input().split())
    for num in a:
        no[num-1] = False

print(sum(no))

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

Solution (Python):
def LI():return list(map(int,input().split()))

n,k=LI()
dA=[]
ans=set([])
for i in range(k):
    d=int(input())
    for a in LI():
        ans.add(a)
print(n-len(ans))

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 range(d):
        s.add(a[j])
print(n - len(s))