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

print(n-len(A))

Solution (Python):
from sys import setrecursionlimit, exit
setrecursionlimit(1000000000)

def main():
    n, k = map(int, input().split())
    have = set()
    for _ in range(k):
        input()
        for i in map(int, input().split()):
            have.add(i)
    print(n - len(have))

main()

Solution (Python):
import sys
input=sys.stdin.readline
n,k=map(int,input().split())
res=[]
for i in range(k):
    d=int(input())
    arr=list(map(int,input().split()))
    [res.append(x) for x in arr if x not in res]
print(n-len(res))

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

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

Solution (Python):
nums = [int(e) for e in input().split()]
N = nums[0]
K = nums[1]

list0 = []
for i in range(0, 2*K):
  val = [int(e) for e in input().split()]
  if i%2 == 1:
      list0.extend(val)

num = N - len(list(set(list0)))

print(num)

Solution (Python):
N, K = map(int, input().split())
F = [1 for _ in range(N)]
for _ in range(K):
    d = int(input())
    for a in map(int, input().split()):
        F[a - 1] = 0
print(sum(F))

Solution (Python):
N, K = map(int, input().split())
A = [[] for _ in range(N)]
for k in range(K):
    d = int(input())
    for a in map(int, input().split()):
        A[a - 1].append(k)
print(sum([1 for a in A if len(a) == 0]))

Solution (Python):
n, k = list(map(int, input().split()))
sunuke_list = [0] * n
for i in range(k):
    treat_count = input()
    give_treat = list(map(int, input().split()))
    for j in give_treat:
        sunuke_list[j - 1] += 1
print(len([i for i in sunuke_list if i == 0]))

Solution (Python):

import numpy as np
N, K = [int(i) for i in input().split()]


cnt = np.zeros([1, N], dtype=int)



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

print(np.count_nonzero(cnt == 0))

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

Solution (Python):

val = input().split(" ")
N = int(val[0])
K = int(val[1])

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

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

for i in range(0, K):
    num_of_holder = int(input())
    holder_set = set([int(i) for i in input().split(" ")])

    not_have = initial - holder_set

    nhave = nhave & not_have

print(len(nhave))

Solution (Python):
s = set()
n,k = map(int,input().split())
for i in range(k):
  d_1 = int(input())
  a_i = map(int,input().split())
  A_i = list(a_i)
  for hito in A_i:
    s.add(hito)
print(n-len(s))

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

for i in range(K):
  d = int(input())
  indexs = [int(i) - 1 for i in input().split()]
  for index in indexs:
    sunukes[index] = 0
print(sum(sunukes))

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



not_hoyu_list=[x+1 for x in range(N)]


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

    for j in hoyulist:
        if j in not_hoyu_list:
            not_hoyu_list.remove(j)

print(len(not_hoyu_list))

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

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

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

Solution (Python):
N, K = map(int, input().split())
n = []
for i in range(N):
  n.append(1)
for j in range(K):
  di = int(input())
  l = input().split()
  for k in range(di):
    if n[int(l[k])-1] == 1:
      n[int(l[k])-1] = 0
r = 0
for i in range(N):
  r += n[i]
print(r)

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

for _ in range(k):
  d = int(input())
  a += [int(m) for m in input().split()]

print(n - len(set(a)))

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

for i in range(k):
    treat_count = input()
    give_treat = list(map(int, input().split()))
    for j in give_treat:
        sunuke_list[j - 1] += 1

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

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

Solution (Python):

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

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

aset=set(alist)
res=n-len(aset)
print(res)

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

print(n-len(a))

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

seta = set(a)
print(n-len(seta))

Solution (Python):
S, K = map(int, input().split())
A = set()
for i in range(K):
  d = int(input())
  Alist = list(map(int, input().split()))
  for j in range(d):
    A.add(Alist[j])
print(S-len(A))

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

    s=int(input())
    list1.extend(list(map(int,input().split())))


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

Solution (Python):


N, K = (int(_) for _ in input().split())

ret = [1] * N
for k in range(K):
    d = input()
    A = (int(_) - 1 for _ in input().split())
    for a in A:
        ret[a] = 0
print(sum(ret))

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

indexs = []
for i in range(len(L)):
    if i%2 != 0:
        indexs.append(L[i])

uniq_list = []
for li in indexs:
    for e in li:
        if e not in uniq_list:
            uniq_list.append(e)

print(N - len(uniq_list))

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(map(int,input().split()))
    sunuke=sunuke-a
print(len(sunuke))

Solution (Python):
N, K = map(int, input().split())
sunuke = [1] * N
for i in range(K):
  di = int(input())
  ai = map(int, input().split())
  for j in ai:
    sunuke[j - 1] = 0
print(sum(sunuke))

Solution (Python):
N, K = map(int, input().split())
used = [False]*(N+1)
for _ in range(K):
    _ = int(input())
    for i in map(int, input().split()):
        used[i] = True
print(N-sum(used))

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

Solution (Python):


from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement

N, K = [int(_) for _ in input().split()]
A = [[int(_) for _ in input().split()] for i in range(K+K)]
A = [A[i] for i in range(K+K) if i % 2 == 1]
a = []
for i in A:
    a += i
print(N - len(list(set(a))))

Solution (Python):
n,k = map(int,input().split())
master = []
count = 0
for num in range(k):
    d = input()
    sunuke = list(map(int,input().split()))
    master+=sunuke

print(n-len(set(master)))

Solution (Python):
h = [int(x) for x in input().split(' ')]
n = h[0]
k = h[1]

result = 0

l = {}
for i in range(n):
  l[i+1] = False

for i in range(k):
  num = input()
  has = [int(x) for x in input().split(' ')]
  for mem in has:
    l[mem] = True

for mem in l.values():
  if not mem:
    result += 1

print(result)

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

snukes = [0] * N

for i in range(K):
    d = int(input())
    arr = list(input().split())
    for j in range(d):
        snukes[int(arr[j]) - 1] += 1

non_zero_values = 0
for i in range(N):
    if snukes[i] == 0:
        non_zero_values += 1

print(non_zero_values)

Solution (Python):

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

havent = [0] + [1] * N

for i in range(K):
    d = int(input())
    a = list(map(int,input().split()))
    for e in  a:
        havent[e] = 0
print(sum(havent))

Solution (Python):
N,K=map(int,input().split())
hoge={}
for j in range(K):
    input()
    [hoge.update({int(j)-1:1}) for j in input().split()]
print(sum([not j in hoge for j in range(N)]))

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

snacklist = [0]*n

for num in range(0, k):
    d = input()

    boylist = list(map(int, input().split()))

    for bl in boylist:
        snacklist[bl-1] += 1


count = 0

for sl in snacklist:
    if sl == 0:
        count += 1

print(count)

Solution (Python):
temp = input().split(" ")
N = int(temp[0])
K = int(temp[1])

kashi = []
for i in range(K):
    input()
    temp = input().split(" ")
    kashi.extend(temp)

ans = 0
for i in range(N):
    if str(i+1) not in kashi:
        ans += 1

print(ans)

Solution (Python):
N,K=map(int,input().split())
hoge=[0 for j in range(N)]
for j in range(K):
    input()
    for i in input().split():
        hoge[int(i)-1]+=1
print(sum([j==0 for j in hoge]))

Solution (Python):




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


def input_int_list_with_length(length=None):
    if length == None:
        length = int(input())
    return list(map(int, input().split()))[:length]


def list_uniq_count(l):
    return len(set(l))


def solve(N: int, K: int):
    l = []
    for _ in range(K):
        l += input_int_list_with_length()
    print(N-list_uniq_count(l))


def main():
    solve(*input_int_list())


if __name__ == '__main__':
    main()

Solution (Python):

from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect

def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.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()
    flag_list = [False] * n
    for _ in range(k):
        d = I()
        a = LI()
        for i in range(d):
            flag_list[a[i]-1] = True
    print(flag_list.count(False))
    
    return


if __name__ == "__main__":
    solve()

Solution (Python):




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


def input_int_list_with_length(length=None):
    if length == None:
        length = int(input())
    return list(map(int, input().split()))[:length]


def solve(N: int, K: int):
    l = []
    for _ in range(K):
        l += input_int_list_with_length()
    print(N-len(set(l)))


def main():
    solve(*input_int_list())


if __name__ == '__main__':
    main()

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

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

Solution (Python):


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

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

count=0
for i in range(N):
    if C[i]==0:
        count=count+1


print("{}".format(count))

Solution (Python):
if __name__ == "__main__":
  str_N_K = input()
  
  list_N_K = str_N_K.split(' ')
  N = int(list_N_K[0])
  K = int(list_N_K[1])
  
  list_person = [0] * N
  
  for _ in range(K):
    d = int(input())
    str_persons = input()
    if (" " in str_persons):
      list_str_persons = str_persons.split(" ")
    else:
      list_str_persons = [str_persons]
      
    for str_person in list_str_persons:
      int_person = int(str_person)
      list_person[int_person-1] += 1
  
  output = 0
  for person in list_person:
    if person == 0:
      output += 1
      
  print(output)

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

N, K = map(int, input().split())
d = []
A = [[]] * K
sunuke = [0] * N

for k in range(K):
	d.append(int(input()))
	A[k] = map(int, input().split())
	for a in A[k]:
		sunuke[a-1] += 1

print(sunuke.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 s in a:
		t[s-1] += 1
print(t.count(0))

Solution (Python):
N, K = map(int, input().split(" "))
sunuke = set()
for i in range(K):
    _, p = input(), input()
    sunuke = sunuke.union(map(int, p.split(" ")))
print(N - len(sunuke))

Solution (Python):
line1 = input().split()
n = int(line1[0])
k = int(line1[1])
list1 = []
for i in range(k):
  d = input()
  lst = input().split()
  list1 += lst

set1 = set(list1)
nothing = set(str(i+1) for i in range(n)) - set1
print(len(nothing))

Solution (Python):
person, snack = map(int, input().split(" "))

persons = {i+1 for i in range(person)}

for i in range(snack):
    _ = int(input())
    for p in list(map(int, input().split(" "))):
        persons.discard(p)

print(len(persons))

Solution (Python):


N, K = map(int, input().split())
ls = []
for _ in range(K):
    d = int(input())
    A = [int(a) for a in input().split()]
    ls += A

print(N - len(set(ls)))

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

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

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

print(cnt.count(0))

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

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

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

sunuke = [0] * n

for i in range(k):
    for j in range(d[i]):
        sunuke[sweets_matrix[i][j]-1] += 1

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

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

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

Solution (Python):
def str_to_int(lista):
    for num, i in enumerate(lista):
        lista[num]=int(i)
        
def main():
    list_NK = input().split()
    str_to_int(list_NK)
    list_N = []
    list_K=[]
    for i in range(list_NK[1]):
        list_K.append(input())
        temp = input().split()
        str_to_int(temp)
        for j in temp:
            if j not in list_N:
                list_N.append(j)
    print(list_NK[0]-len(list_N))

main()

Solution (Python):
n,k = map(int,input().split())
res = [0]*n
for i in range(k):
    d = int(input())
    a = list(map(int,input().split()))
    for key in a:
        res[key-1]+=1
res = list(filter(lambda x:x==0,res))
print(len(res))

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

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

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

Solution (Python):



N, K = map(int, input().split())
sunukes = {n+1 for n in range(N)}


for i in range(K):
    d_i = int(input())
    for n in map(int, input().split()):
        n in sunukes and sunukes.remove(n)

print(len(sunukes))

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

print(ans.count(0))

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

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

print(len(sunuke))

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

snuke_have_sweets = [False] * (N + 1)
for _ in range(K):
    D = int(input())
    A = [int(i) for i in input().split()]
    for a in A:
        snuke_have_sweets[a] = True

print(N - sum(snuke_have_sweets[1:]))

Solution (Python):




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

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


if __name__ == "__main__":
    main()

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

res_list_set = list(set(res_list))
print( n - len(res_list_set))

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

l = []

for i in range(k):
  d = input()
  l.append(set([int(x) for x in input().split()]))
  
s = set()
for i in l:
  s = s.union(i)
  
all_set = set([x+1 for x in range(n)])
def_set = all_set.difference(s)
print(len(def_set))

Solution (Python):
N, K = map(int, input().split())
have = set()
for i in range(1, K+1):
    di = int(input())
    for h in list(map(int, input().split())):
        have.add(h)
print(N - len(have))

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

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

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

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

Solution (Python):
N,K=map(int,input().split())
kashi_num = [str(i+1) for i in range(N)]
for _ in range(K):
  d = input()
  for a in input().split():
    if a in kashi_num:
      kashi_num.remove(a)
  if len(kashi_num)==0:
    break
print(len(kashi_num))

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

C=set(list(range(1,N+1)))
print(len(C-set(B)))

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

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

    have = []
    for a in A:
        have[len(have):] = set(a)
    print(N - len(set(have)))


if __name__ == "__main__":
    main()

Solution (Python):
n, k = [int(x) for x in input().split()]
A = {}
for i in range(k):
    d = int(input())
    for x in input().split():
        A[x] = True

print(n - len(A))

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

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

susuke = [1] * N

for i in range(K):
  di = int(input())
  ai = map(int, input().split())
  for j in ai:
    susuke[j - 1] = 0
    
print(sum(susuke))

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

for i in range(k):
    input()
    a = set(map(int, input().split()))
    m -= a

print(len(m))

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

n,k = (int(x) for x in input().split())
lst = [0 for _ in range(n)]
for i in range(k):
    d = int(input())
    seq = [int(x) for x in input().split()]
    for val in seq:
        lst[val-1] += 1
print(sum((val==0 for val in lst)))

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

Solution (Python):

n, k = map(int,input().split())
d = [0]*k
a = [1]*n

for i in range(k):
    d[i] = int(input())
    sunuke_i = map(int,input().split())
    for t in sunuke_i:
        a[t-1]=0
print(sum(a))

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

print(N-len(set(ans)))

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

for i in range(k):
  d = int(input())
  A = list(map(int, input().split()))
  for d in range(d):
    for a in A:
      if a in sunuke:
        sunuke.remove(a)
    
print(len(sunuke))

Solution (Python):
"""
n snukes
k kinds of snacks


the following di snukes have


"""
import collections

n, k = map(int, raw_input().split(' '))

cc = collections.Counter()
for i in range(k):
	d = int(raw_input())
	for u in map(int,raw_input().split(' ')): cc[u] +=1

count = 0
for u in range(1,n+1):
	if cc[u] == 0: count+=1
print count

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

print(len(S))

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

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

Solution (Python):
N,K = map(int,input().split())
A = []
for i in range(K):
    d1 = int(input())
    a = list(map(int,input().split()))
    A.append(a)
ans = {i:0 for i in range(1,N+1)}
for a in A:
    for d in a:
        ans[d] = 1
ans2 = 0
for j in ans.keys():
    if ans[j] == 0:
        ans2 += 1
print(ans2)

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

Bs = [0 for i in range(N + 1)]
for _ in range(K):
    d = int(input())
    As = list(map(int, input().split()))
    for a in As:
        Bs[a] += 1
cnt = 0
for b in Bs[1:]:
    if b == 0:
        cnt += 1

print(cnt)

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())))
x=[0]+[1]*n
for i in range(k):
    for j in range(d[i]):
        x[a[i][j]]=0
print(sum(x))

Solution (Python):
s = input().split()
N, K = int(s[0]), int(s[1])
victims = [True]*N
for k in range(K):
  d = input()
  a = input().split()
  for i in a:
    victims[int(i)-1] = False
print(sum(victims))

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

N_list = []
for i in range(1, N+1):
    N_list.append(i)
for i in range(K):
    L = int(input())
    P_list = [int(x) for x in input().split()]
    for P in P_list:
        if P in N_list:
            N_list.remove(P)

print(len(N_list))

Solution (Python):
n,k=map(int,input().split())
sweets = [0]*n
for _ in range(k):
  _ = input()
  for i in map(int, input().split()):
    sweets[i-1] += 1
print(sum(i<1 for i in sweets))

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

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

print(A.count(0))

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

for i in range(k):
    input()
    a = set(map(int, input().split()))
    nn -= a

print(len(nn))

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

snk_sweets = []

for i in range(K):
    sweets = input()
    snk_sweets = snk_sweets + input().split()

len_snk = len(set(snk_sweets))
print(N - len_snk)

Solution (Python):
n,m=map(int,input().split())
l=[1 for i in range(n)]
for i in range(m):
  input()
  for j in input().split():
    l[int(j)-1]=0
print(sum(l))

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

for i in range(k):
    input()
    a = set(map(int, input().split()))
    nn -= a

print(len(nn))

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

count = 0

sunuke = list(range(1,N+1))

for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for a in A:
        try:
            sunuke.remove(a)
        except ValueError:
            continue
print(len(sunuke))

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

for i in range(k):
    d = int(input())
    a = [int(j) for j in input().split()]
    for m in range(d):
        s[a[m]-1] += 1
        
for i in range(n):
    if s[i]==0:
        ans += 1

print(ans)

Solution (Python):
n,k=map(int,input().split())
x=[c for c in range(1,n+1)]
for i in range(1,k+1):
  d=int(input())
  s=input().split()
  for b in range(d):
    if int(s[b]) in x:
      x.remove(int(s[b]))
print(len(x))

Solution (Python):
n, k = [int(i) for i in input().split()]
s = [i + 1 for i in range(n)]
for i in range(k):
  d = int(input())
  ns = [int(j) for j in input().split()]
  for l in ns:
    s.remove(l) if l in s else None
print(len(s))

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

Solution (Python):
n,k=map(int,input().split())
x=[c for c in range(1,n+1)]
for i in range(1,k+1):
  d_i=int(input())
  s_i=input().split()
  for b in range(d_i):
    if int(s_i[b]) in x:
      x.remove(int(s_i[b]))
print(len(x))

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

ans=set()
for aa in a:
    ans=ans|set(aa)

print(n-len(ans))

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

Solution (Python):
N, K = input().split()
nusk = [0 for i in range(int(N))]
for i in range(int(K)):
    D = int(input())
    A = input().split()
    for item in A:
        nusk[int(item)-1] += 1

print(nusk.count(0))

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

Solution (Python):
nk = input().split()
n = int(nk[0])
k = int(nk[1])
s = [input().split() for i in range(k*2)]
o = []
 
for  j in range(len(s)):
    if j % 2 == 0:
        pass
    else:
        o[len(o):len(o)] = s[j]
 
l =list(set(o))
ans = n - len(l) 
print(ans)

Solution (Python):


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

print(sum(c))

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

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

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

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

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

for i in range(k):
  d=int(input())
  a=list(map(int, input().split()))
  ans=set(ans)-set(a)
print(len(ans))

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


if __name__ == "__main__":
    main()

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

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

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

print(N - len(set(l)))

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

visited = [False for _ in range(n)]

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

ret = 0
for cur in visited:
    if cur == False:
        ret += 1

print(ret)

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

list_a = [0]*N

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

print(list_a.count(0))

Solution (Python):

input1 = input().rstrip().split(" ")
sunuke = [0 for i in range(int(input1[0]))]
array = []
for i in range(int(input1[1])):
    okashi = input()
    okashisunuke = input().rstrip().split(" ")
    for i in range(int(okashi)):
        sunuke[int(okashisunuke[i])-1] += 1
print (sunuke.count(0))