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=map(int,input().split())
AA=set([])
for i in range(k):
  d=int(input())
  A=list(map(int,input().split()))
  AA=AA|set(A)
print(n-len(AA))

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

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

Solution (Python):
N, K = [int(i) for i in input().split()]
count = [0]*N

for _ in range(K):
  d = int(input())
  for v in input().split():
    j = int(v) - 1
    count[j] += 1
sunsuke = 0 
for i in count:
  if i == 0:
    sunsuke += 1
print(sunsuke)

Solution (Python):
s = []
j = 0
num = 0

n,k = map(int, input().split())
for i in range(k):
  d = int(input())
  s.extend(input().split())

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

Solution (Python):
n, k = map(int, input().split())
num = []
s = [input() for i in range(2*k)]

for i in range(1,n + 1):
  num.append(i)
  
for j in range(k):
  rm_tg = s[2*j+1].split()
  for m in range(int(s[2*j])):
    for sin in num:
      if sin == int(rm_tg[m]):
        num.remove(int(rm_tg[m]))

        
print(len(num))

Solution (Python):
n, k = map(int, input().split())
res = [True for _ in range(n)]
for _ in range(k):
	d = int(input())
	a = list(map(int, input().split()))
	for x in a:
		res[x-1] = False
print(sum(res))

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

for _ in range(k):
    d = int(input())
    t = list(map(int, input().split()))
    for i in range(len(t)):
        s.add(t[i])


print(n - len(s))

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

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

l = set(s)

print(n - len(l))

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, k = map(int, readline().split())
aa = []
for i in range(k):
    readline()
    aa += list(map(int, readline().split()))
cnt = 0
for i in range(1, n + 1):
    if i not in aa:
        cnt += 1
print(cnt)

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

sunuke = 0
for i in range(1,N+1):
    if i in okashi_sunuke:
        sunuke +=1

print(N-sunuke)

Solution (Python):
import numpy as np
N,K = list(map(int, input().split()))

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


res = []
for i in range(1,N+1):
    if not np.any(i in A):
        res.append(i)

print(len(res))

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


s = set(itertools.chain.from_iterable(A))
print(N - len(s))

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

for k in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for a in A:
        result[a-1] = 1
    A.clear()

print(result.count(0))

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

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


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

print(cnt.count(0))

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

li = []

for i in range(k):
    d = int(input())
    a_li = list(map(int, input().split()))
    li += a_li

print(n - len(set(li)))

Solution (Python):
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))



N,K = LI()
X = [False]*N
for i in range(K):
    d = I()
    a = LI()
    for a0 in a:
        X[a0-1] = True

ans = 0
for i in range(N):
    if not X[i]:
        ans += 1

print(ans)

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


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


print(list_1.count(0))

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

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

d = [0]*n

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


print(d.count(0))

Solution (Python):
import numpy as np
n, k = map(int, input().split())
a = np.zeros(n + 1)
a[0] = 1
for i in range(k):
    d = int(input())
    a[np.array(list(map(int, input().split())))] += 1
print(np.count_nonzero(a == 0))

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


for i in range(k):
  d=int(input())
 
  List=list(map(int,input().split()))
  for i in range(d):
    s[List[i]-1]=1
print(n-sum(s))

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

print(a.count(0))

Solution (Python):
n, k = map(int, input().split())
group = set()
for _ in range(k):
  no = input()
  okashi = list(map(int, input().split()))
  for i in okashi:
  	group.add(i)
print(n - len(group))

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.buffer.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):
        LI()
        a = LI()
        for i in a:
            d[i-1] = 1
    print(n-sum(d))
    return


if __name__ == "__main__":
    solve()

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

s = list(set((list(itertools.chain.from_iterable(A)))))
print(N - len(s))

Solution (Python):
from collections import defaultdict as dc
n,k = map(int,input().split())
DICT = dc(lambda:0)
for i in range(k):
    d = int(input())
    l = list(map(int,input().split()))

    for i in range(d):
        DICT[l[i]]+=1
ans = 0
for i in range(1,n+1):
    if DICT[i] == 0:
        ans += 1

print(ans)

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

okashi = [0] * N

for l in range(K):
    for i in A[l]:
        okashi[i-1] += 1

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

print(count)

Solution (Python):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n, k = list(map(int, readline().split()))

    snuke = [False] * n

    for i in range(k):
        d = int(input())
        a = list(map(int, readline().split()))
        for num in a:
            snuke[num-1] = True

    ans = snuke.count(False)
    print(ans)

if __name__ == '__main__':
    main()

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 p in A:
    L[p - 1] = 1
  
print(L.count(0))

Solution (Python):
N, K = 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())
ans = list(range(1,n+1))
num_list = []
for i in range(2*k) :
    num_list.append(list(map(int, input().split())))

for i in range(0,k) :
    del num_list[i]

for value in num_list :
    for values in value :
        if values in ans :
            ans.remove(values)

print(len(ans))

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

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

ans = 0

for x in range(1,n+1):
	if x not in s:
		ans += 1

print(ans)

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

for i in range(0, K):
  input()
  shuger = map(int, input().split())
  for n in shuger:
    member[int(n)-1]=0
print(member.count(1))

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

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

Solution (Python):
import numpy as np
N, K = map(int, input().split())
 
A = np.zeros(N, dtype=int)
 
for _ in range(K):
    input()
    for i in input().split():
        A[int(i) - 1] += 1
 
ans = 0
for i in A:
    if i == 0:
        ans += 1
print(ans)

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

count = 0
flag = 0
for i in range(N):
    flag = 0
    for j in range(K):
        if (i+1 in A[j]) is True:
            flag = 1
            break
    if flag == 0:
        count += 1
print(count)

Solution (Python):
(a,b) = input().split()
a = int (a)
a = a + 1
b = int (b)
list_a = set(range(1,a,1))
for i in range(b):
    c = input()
    d = input().split()
    d = set(map(int,d))
    list_a = list_a-d
print(len(list_a))

Solution (Python):


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


sunuke_dic = {}

for i in range(1,K+1):
    d = int(input().strip())
    A_list = list(map(int, input().rstrip().split()))
    
    for a in A_list:
        sunuke_dic.setdefault(a,[])
        sunuke_dic[a].append(i)


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


print(cnt)

Solution (Python):
N,K=map(int,input().split())
A=[0 for i in range(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

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

print(str(ans))

Solution (Python):
N, K = map(int, input().split())
q = set([])
for _ in range(K):
    d = int(input())
    tmp = list(map(int, input().split()))
    for i in range(d):
        q.add(tmp[i])

ans = N - len(q)

print(ans)

Solution (Python):
N,K=map(int,input().split())
l=[x for x in range(1,N+1)]
for i in range(K):
	d=int(input())
	A=list(map(int,input().strip().split()))
	for j in range(len(A)):
		if A[j] in l:
			l.remove(A[j])
print(len(l))

Solution (Python):
(a,b) = input().split()
a = int (a)
a = a + 1
b = int (b)
list_a = set(range(1,a,1))
for i in range(b):
    c = input()
    d = input().split()
    d = set(map(int,d))
    list_a = list_a-d
print(len(list_a))

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



def linput(_t=int):
    return list(map(_t, input().split()))

def gcd(n,m):
    while m: n,m = m, n%m
    return n

def lcm(n,m): return n*m//gcd(n,m)

def main():
    
    N,K = linput()
    
    

    
    vV = [0,] + [0,]*N

    
    
    

    for i in range(K):
        X = int(input())
        vL = linput()
        for j in vL:
            vV[j] = 1
        
    res = N - sum(vV)


    
    print(res)

    


main()

Solution (Python):
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7 
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    n, k = map(int,input().split())
    have = [False] * n
    for _ in range(k):
        input()
        for a in map(int,input().split()):
            have[a - 1] = True
    print(n - sum(have))
resolve()

Solution (Python):
def main():
    import sys
    N,K=list(map(int,sys.stdin.readline().split()))
    st=set()
    for i in range(K):
        d=int(sys.stdin.readline())
        A=list(map(int,sys.stdin.readline().split()))
        st=st|set(A)
    print(N-len(st))
    
main()

Solution (Python):
n, m = map(int, input().split())
ql = [tuple(map(int, input().split())) for i in range(2*m)]
a = ql[1::2]
b = []
for x in a:
    b += x
ans = n - len(set(b))
print(ans)

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

print(cnt.count(0))

Solution (Python):
N, K = [int(v) for v in input().split()]

count = [0] * N

for _ in range(K):
    d = int(input())
    for v in input().split():
        j = int(v) - 1
        count[j] += 1

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

print(sunuke)

Solution (Python):
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) 
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    


MOD = 10**9 + 7
INF = 2**31  

from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  
from math import gcd

N, K = read_ints()
is_okasi = [False] * N  
for _ in range(K):
    read()
    A = read_ints()
    for a in A:
        is_okasi[a - 1] = True

print(N - sum(is_okasi))

Solution (Python):
a,b=input().split()
c=int(a)
d=int(b)
e=[]
for i in range(c):
    e.append(i+1)
for j in range(d):
    f=int(input())
    g=input().split()
    h=[int(s) for s in g]
    for n in range(len(h)):
        if h[n] in e:
            e.remove(h[n])
print(len(e))

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

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')


N, K = MI()
s = set()
for i in range(K):
    I()
    for a in LMI():
        s.add(a)

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

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

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.buffer.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 = map(int,input().split())
    count = [0]*N
    
    for i in range(K):
      d = int(input())
      A = list(map(int,input().split()))

      for s in range(d):
        a = A[s]
        count[a-1] += 1

    print(count.count(0))
    return


if __name__ == "__main__":
    solve()

Solution (Python):

import sys

import fractions
import copy
import bisect
import math
import numpy as np
import itertools
from itertools import combinations_with_replacement


from operator import itemgetter
from sys import stdin

from operator import mul
from functools import reduce
from collections import Counter
import collections





j=0
k=0
n=3
r=1
a=[0]






"1行1つの整数を入力を取得し、整数と取得する"




"12 21 332 とか入力する時に使う"
"1行に複数の整数の入力を取得し、整数として扱う"

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

for i in number_list:
    print(number_list[i-1])

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'''
x=[]
y=[]
for i in range(N):
    x1, y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)
print(x)
print(y)
"複数行に2数値を入力する形式 x座標とy座標を入力するイメージ"
'''

'''
mixlist=[]
for i in range(N):
    a,b=input().split()
    mixlist.append((int(a),b))
print(mixlist)
"複数行にintとstrを複合して入力するやつ，今回はリスト一つで処理している"
'''

'''



"正方行列にstr型の値を入力"
'''




'''
入力
1 2
4 5
7 8
出力結果
[[1, 2], [4, 5], [7, 8]]
'''
"列数に関して自由度の高いint型の値を入力するタイプの行列"


'''
table = [[int(i) for i in input().split()] for m in range(m)]

print(type(N))
print(N)
print(type(M))
print(M)

print(type(table))
print(table)
'''











'''
入力
1234
出力
1
[[1, 2, 3, 4]]
'''




'''
word_list= input().split(" ")
print(word_list[0])
"連続文字列の入力"
"qw er ty とかの入力に使う"
"入力すると空白で区切ったところでlistの番号が与えられる"
'''



'''
A, B, C=stdin.readline().rstrip().split()
print(A)
"リストではなく独立したstr型を入れるなら以下のやり方でOK"
'''




"aという変数に入っているものを大文字にして出力"















'''
コンビネーションの組み合わせの中身を出力する形式
for i in itertools.combinations(brray, 2)
combinationsをpermutationsにすれば順列になる
今回なら(abc133B)
入力
1 2
5 5
-2 8
出力
[[1, 2], [5, 5], [-2, 8]]
もちろん一次元リストでも使えるし
何よりiもリストのように使えるので便利
'''


'''
def cmb(n,r):
    
    r= min(n-r,r)
    
    if r == 0: return 1
    over = reduce(mul, range(n, n-r, -1))
    
    
    

    under = reduce(mul, range(1, r+1))
    
    
    
    

    return over // under
    
    
    
    
a = cmb(n, r)

'''

'''
import itertools
from itertools import combinations_with_replacement

combinationについて
以下の違いを意識しよう
combinations() p, r 長さrのタプル列、ソートされた順で重複なし

combinations_with_replacement() p, r 長さrのタプル列、ソートされた順で重複あり


使用例 　　　　　　　　　　　                  出力　　
combinations('ABCD', 2)　　　　　　　　　　　　AB AC AD BC BD CD

combinations_with_replacement('ABCD', 2)　　 AA AB AC AD BB BC BD CC CD DD
'''



'''




for i in a.most_common(n):print(i)





 


'''









'''
bisect.bisect_left(a, x, lo=0, h=len(a))
引数
a: ソート済みリスト
x: 挿入したい値
lo: 探索範囲の下限
hi: 探索範囲の上限
(lo, hiはスライスと同様の指定方法)
bisect_leftはソートされたリストaに対して順序を保ったままxを挿入できる箇所を探索します。leftが示す通り、aにすでにxが存在している場合は、挿入箇所は既存のxよりも左側になります。また、lo, hiを指定することで探索範囲を絞り込むことも可能です。デフォルトはaの全体が探索対象です。
'''














def main():


    j=0
    k=0
    
    

    N,K=map(int, input().split(" "))
    d_lis=[]

    k_lis=[[] for i in range(K)]
    
    c_lis=[]
    pp=0
    d_lis=[]
    "1行1つの整数を入力を取得し、整数と取得する"
    for i in range(N):
        c_lis.append(i+1)

    for i in range(K):
        d_lis.append(int(input()))
        k_lis[i]=list(map(int, input().split(" ")))
    
    
    
    
    
        number_list=[]
    

    
        
    
    
    
    
    
    "12 21 332 とか入力する時に使う"
    "1行に複数の整数の入力を取得し、整数として扱う"
    
    
    
    
    
    
    ss=collections.Counter(tuple(itertools.chain.from_iterable(k_lis)))
    
    
    
    
    
    
    
    print(N-len(ss))
    
    
    
    '''
    入力
    1234
    出力
    [1, 2, 3, 4]
    '''



if __name__ == "__main__":
    main()

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

menber = list(range(1, N+1))
have_list = list(set(itertools.chain.from_iterable(a)))

res = len(menber) - len(have_list)
print(res)

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

Solution (Python):
n, k = list(map(int, input().split()))
snukes = [0] * n
for x in range(k):
    input()
    y = ((list(map(int, input().split()))))
    for i in y:
        snukes[i - 1] = 1

print(snukes.count(0))

Solution (Python):
n, k = [int(i) for i in input().split()]
ds = []
As = []
for i in range(k):
    ds.append(int(input()))
    As += [int(j) for j in input().split()]
 
 
print(n-len(set(As)))

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

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

for i in A:
    count += 1

print(N - count)

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


array = [0] * N 


for b in range(1,K+1): 
    a = int(input()) 
    i = list(map(int, input().split())) 
    
    for c in range(a):
        
        array[i[c]-1] = 1


for k in range(N):
    if array[k] == 0:
        count += 1

print(count)

Solution (Python):

def add_list(LIST):
    return LIST +1

def flatten(nested_list):
    """2重のリストをフラットにする関数"""
    return [e for inner_list in nested_list for e in inner_list]


N, K = (int(x) for x in input().split())
List_1 = []
List_2 = []
for  i in range(K):
    List_1.append([int(input())])
    List_2.append([int(y) for y in input().split()])

men = list(range(N))
men_add = list(map(lambda z: z + 1, men))

flatten_list = flatten(List_2)


for j in range(len(set(flatten_list))):
    try:
        men_add.remove(j+1)
    except ValueError:
        pass

print(len(men_add))

Solution (Python):
nk = list(map(int, input().split()))
n= nk[0]
k=nk[1]
d=[]
a=[]
for i in range(k):
    d.append(int(input()))
    a.append(list(map(int, input().split())))
count=[None] * n

for i in range(len(d)):
    if len(a[i]) == 0:
        count[a[i]-1] = True
    else:
        for j in range(len(a[i])):
            count[a[i][j]-1] = True

print(count.count(None))

Solution (Python):
no_snukes, types_snacks = list(map(int, input().split()))

snukes_arr = [0 for i in range(no_snukes)]


for i in range(types_snacks):
    snack = int(input())
    snukes_who_have = list(map(int, input().split()))
    for s in snukes_who_have:
        snukes_arr[s-1] += 1

dead_boy = 0

for i in range(len(snukes_arr)):
    if snukes_arr[i] == 0:
        dead_boy += 1

print(dead_boy)

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

for i in range(n):
	if sunuke[i]==0:
		cnt+=1
print(cnt)

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

count=0

for i in range(1,n+1):
    if i in a_list:
        pass
    else:
        count+=1
print(count)

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

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

        

print(len(set(a)-set(l)))

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

Solution (Python):
n, k = map(int, input().split())
A_list  =[]
import numpy as np
nuske = np.zeros(n)

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

p =0

for i in range(len(nuske)):
    if nuske[i] ==0:
        p+=1

print(p)

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

num_list = []
d = []
for i in range(N):
  try:
      d.append(list(map(int,input().split())))
      num_list.append(list(map(int,input().split())))
  except EOFError:
    pass
  

snack = set(sum(num_list, []))

ppl = []
for i in range(N):
    ppl.append(N)
    N -= 1
    
nsnack = set(ppl) - snack
nosnack = list(nsnack)

print(len(nosnack))

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

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

cnt = 0                    
for q in N:
    if q != 0:
        cnt += 1
print(cnt)

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

Solution (Python):
def main():
    n, k = map(int, input().split())
    sunuke = {}

    for i in range(1, k + 1):
        d = int(input())
        for a in input().split():
            if a in sunuke.keys():
                sunuke[a] += str(i)
            else:
                sunuke[a] = str(i)

    kind_of_sunuke = sunuke.keys()
    count = 0
    for j in range(1, n + 1):
        if str(j) not in kind_of_sunuke:
            count += 1
    print(count)

if __name__ == '__main__':
    main()

Solution (Python):
import collections
N,K=map(int,input().split())
a=[]
d=[]
while K>0:
  K=K-1
  d.append(int(input()))
  b=list(map(int,input().split()))
  a.extend(b)
e=collections.Counter(a)
print(N-len(e))

Solution (Python):


N, K = [int(i) for i in input().split()]
snk = [0 for _ in range(N)]
for i in range(K):
    d = int(input())
    a_d = [int(i) for i in input().split()]
    for a in a_d:
        snk[a-1] += 1
print(snk.count(0))

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


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

n=[]
for j in range(N):
  n.append(j+1)
  
cnt=0
for j in range(N):
  if a.count(j+1)==0:
    cnt=cnt+1
print(cnt)

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

have = set()

for i in range(1,k+1):
    d = int(input())
    li = list(map(int, input().split()))
    have = have | set(li)

print(n-len(have))

Solution (Python):




n,k = map(int,input().split())
s = {i+1 for i in range(n)}

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

    s -= a_set

print(len(s))

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

ans = {}
for i in range(0, K):
  input()
  A_hpge_strlist = input().split(' ')
  for A_hoge_str in A_hpge_strlist:
    ans[int(A_hoge_str)] = 0
print(N - len(ans.keys()))

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

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

Solution (Python):
N,K=map(int,input().split())
a=[list(map(int,input().split()))for i in range(2*K)]
sunuke=[]
for i in range(2*K):
    if i%2==1:
        d=sum(a[i-1])
        for n in range(d):
            sunuke.append(a[i][n])
sunuke=set(sunuke)
print(N-len(sunuke))

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

print(d.count(0))

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

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

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

print(counter)

Solution (Python):
n,k=map(int,input().split())
kashi = [0] * n
cnt = 0
M = 0
for s in range(k):
	i=int(input())
	li=list(map(int,input().split()))
	if i > 0:
		for m in li:
			kashi[m-1] +=1

for i in kashi:
	if i == 0:
		cnt += 1

print(cnt)

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

for k in range(K):
    d=int(input())
    have_k=map(int,input().split())
    for h in have_k:
        a[k][h-1]=1

an=[0]*N
for k in range(K):
  for n in range(N):
    an[n] = an[n]+a[k][n]

result=0
for i in an:
  if i == 0:
    result+=1

print(result)

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

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

for i in range(k):
  d.extend(input())
  a.extend(input().split())

d1 = list(map(int,d))
a1 = list(map(int,a))

ct = 0

for j in range(1,n+1):
  if a1.count(j)==0:
    ct +=1
print(ct)

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

Solution (Python):
N,K = map(int,input().split())
data = []
nolist = list(range(1,N+1))
for i in range(K):
  number = int(input())
  data = input().split()
  for j in range(number):
    nolist[int(data[j])-1] = 0
try:
  for i in range(N):
  	nolist.remove(0)
except:
  pass
print(len(nolist))