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=[]
B=[]
C=[]
D=[]
for i in range(2*K):
    A.append(list(map(int,input().split())))
for i in range(K):
    B.append(A[2*i-1])
for i in range(K):
    for j in range(len(B[i])):
        C.append(B[i][j])
for i in range(1,N+1):
    if i not in C:
        D.append(i)
print(len(D))

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

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

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

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

if __name__ == "__main__":
    resolve()

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

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

ans = N - sum(sunuke)
print(ans)

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

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

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

hold = set()
for i in range(len(A)):
    hold = hold | set(A[i])

print(N - len(hold))

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

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

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

answer = [1] * N

for i in range(K):
	d = int(input())
	tmp = map(int, input().split())

	for j in tmp:
		answer[j-1] = 0

print(sum(answer))

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

for i in range(k):
    d = int(input())
    a = [int(s) for s in input().split()]
    for j in range(d):
        sum[a[j] - 1] += 1       

print(sum.count(0))

Solution (Python):
num_snukes, num_kinds_snack = list(map(int, input().split()))

snack_maps = []

for _ in range(num_kinds_snack):
    num_snukes_has_snack_i = int(input())
    has_snack_list = list(map(int, input().split()))

    snack_maps.append(has_snack_list)

snukes_has_snacks = [False] * num_snukes

for has_snack_list in snack_maps:
    for i in has_snack_list:
        snukes_has_snacks[i - 1] = True

num_victims = len([snuke for snuke in snukes_has_snacks if not snuke])

print(num_victims)

Solution (Python):
N, K = [int(i) for i in input().split(' ')]
s = [True] * N

for i in range(K):
    d = input()
    for j in input().split(' '):
        s[int(j) - 1] = False
print(len([i for i in s if i]))

Solution (Python):
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    n, k = map(int, input().split())
    sunuke = [0] * n
    for _ in range(k):
        d = int(input())
        a = tuple(map(int, input().split()))
        for ae in a:
            sunuke[ae-1] += 1

    r = sunuke.count(0)
    print(r)

if __name__ == '__main__':
    main()

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())
sunuke = []
for _ in range(k):
    d = input()
    tmp = [int(s) for s in input().split()]
    for i in range(len(tmp)):
        sunuke.append(tmp[i])

print(n - len(set(sunuke)))

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

for i in range(K):
    input()
    A.extend(list(map(int, input().split())))

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

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

for i in range(K):
    d.add(input())
    for i in list(map(int, input().split())):
        A.add(i)

print(N-len(A))

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

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

print(s.count(0))

Solution (Python):
def readinput():
    n,k=map(int,input().split())
    okashi=[]
    for _ in range(k):
        d=int(input())
        l=list(map(int,input().split()))
        okashi.append(l)
    return n,k,okashi

def main(n,k,okashi):
    sunuke=[0]*(n+1)
    for l in okashi:
        for su in l:
            sunuke[su]+=1
    count=0
    for i in range(n):
        if sunuke[i+1]==0:
            count+=1
    return count

if __name__=='__main__':
    n,k,okashi=readinput()
    ans=main(n,k,okashi)
    print(ans)

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

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

Solution (Python):


N, K = map(int, input().split())
A = [list(map(int, input().split())) for i in range(K*2)]
D = list(A[::2])
del A[::2]
A = sum(A, [])
a = set(A)
OP = [n +1 for n in range(N)]
op = set(OP)
an = op - a
print(len(list(an)))

Solution (Python):

def main():
    import sys

    input = sys.stdin.readline

    N, K = map(int, input().split())
    res = [False for _ in range(N)]
    for _ in range(K):
        _ = int(input())
        A = [int(x) for x in input().split()]
        for i in A:
            res[i - 1] = True
    print(res.count(False))



if __name__ == '__main__':
    main()

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

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

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

for i in range(k):
    for a in A[i]:
        if C.count(a)!=0:
            C.remove(a)
        
print( len(C) )

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

ans_=[0]*N

for k in range(0,2*K,2):
    k_ = int(input())
    A = list(map(int,input().split()))
    for a in A:
        ans_[a-1]+=1
        
ans=0
for a in ans_:
    if a == 0:
        ans+=1
        
print(ans)

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

num = []
    
for i in range(n):
    cnt = 0
    for j in range(k):
        if i+1 in a[j]:
            cnt += 1
    if cnt == 0:
        num.append(i)
print(len(num))

Solution (Python):
word = list(map(int,input().split()))
dlist = [0]*word[1]
Alist = [0]*word[1]
for i in range(word[1]):
    dlist[i] = int(input())
    Alist[i] = list(map(int,input().split()))

ninzu = [0]*word[0]
for j in range(word[1]):
    for k in range(dlist[j]):
        ninzu[Alist[j][k]-1] += 1
        
print(ninzu.count(0))

Solution (Python):
N, K = list(map(lambda n: int(n), input().split(" ")))
A = []
for i in range(K):
  d = int(input())
  for x in list(map(lambda m: int(m), input().split(" "))):
  	A.append(x)
print(N - len(set(A)))

Solution (Python):
N, K = map(int, input().split())
have = [False] * N
for _ in range(K):
    d = int(input())
    a = list(map(int, input().split()))
    for i in a:
        have[i - 1] = True

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

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

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

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

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

Solution (Python):
import math
def facts(n):
    ans = []
    for  i in range(1, int(math.sqrt(n)+1)):
        if(n%i==0):
            ans.append(i)
            ans.append(n//i)
    ans = sorted(ans)
    return ans


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

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

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

print(n-len(A))

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

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

ans = 0
for i in range(n):
    if i+1 not in A:
        ans += 1
print(ans)

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

for k in nusuke:
  if k == 0:
    ans += 1

print(ans)

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

Solution (Python):
N, K = map(int, input().split())
sub = {(i+1):"Trick" for i in range(N)}
for i in range(K):
  d = int(input())
  prepare = map(int, input().split())
  for j in prepare:
    sub[j] = "Treat"
ans = 0
for v in sub.values():
  if v == "Trick":
    ans += 1
print(ans)

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

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

    snuke = [1] * N
    for _ in range(K):
        _ = int(input())
        A = (int(x) - 1 for x in input().split())
        for x in A:
            snuke[x] = 0
    print(sum(snuke))


if __name__ == '__main__':
    main()

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

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

snacker = set()

for i in range(K):
    dummy=input()
    for j in [int(k) for k in input().split()]:
        snacker.add(j)
print(N-len(snacker))

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 s in Sunuke:
  if s == 0:
     ans += 1
print(ans)

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

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

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

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

for t in range(k):
    d = int(input())
    hito = input().split(" ")
    for u in range(d):
        for v in range(n):
            if hito[u] == sunuke[v]:
                sunuke[v] = 0
            else:
                pass

m = sunuke.count(0)
print(n-m)

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

ans = list(set(sunuke) - set(have))
print(len(ans))

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

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

Solution (Python):

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

A = [0] * N



for okashi_number in range(k):
	di = int(input())
	D = list(map(int,input().split()))
	for x in range(di):
		A[D[x]-1]= 1

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

Solution (Python):
import collections
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()))
B = []
for l in range(K):
    B += A[l]
c = collections.Counter(B)
values, counts = zip(*c.most_common())
ans = N - len(values)
print(ans)

Solution (Python):
import itertools

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

d = []
a = []

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

a = itertools.chain.from_iterable(a)
b = set(a)

print(N - len(b))

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

Solution (Python):
n,k = map(int, input().split())
line = [0 for i in range(n)]
count = 0
for i in range(k):
  d_i = int(input())
  A_list = list(map(int, input().split()))
  for j in A_list:
    line[j-1] += 1
for i in line:
  if i == 0:
    count += 1
print(count)

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

Solution (Python):
N, K = map(int, input().split())
nums = [i for i in range(N)]
for i in range(K):
    d = int(input())
    s = list(map(int, input().split()))
    for j in s:
        if j-1 in nums:
            nums.remove(j-1)

print(len(nums))

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

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

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

okashi = set()
for _ in range(k):
  d = int(input())
  lst = [int(i) for i in input().split()]
  for i in range(d):
    if lst[i] not in okashi:
      okashi.add(lst[i])
count = 0
for i in range(n):
  if i + 1 not in okashi:
    count += 1
print(count)

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

n_l = [1]*n

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

print(sum(n_l))

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

okashi_holders = set()

for _ in range(K):
    _ = input()
    for a in list(map(int, input().split())):
        okashi_holders.add(a)

print(N - len(okashi_holders))

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

okashi_holders = set()

for _ in range(K):
    _ = input()
    for a in list(map(int, input().split())):
        okashi_holders.add(a)

print(len(set(range(1, N + 1)) - okashi_holders))

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

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

myset = set()
for i in range(k):
    d=input()
    l=list(map(int,input().split()))
    myset |= set(l)

print(n-len(myset))

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

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

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

for i in range(k):
  d = int(input())
  l = list(map(int, input().split()))
  for j in range(d):
    if l[j] not in ans:
      ans.append(l[j])

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

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

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

Solution (Python):
def resolve():
    N, K = map(int, input().split())
    D = []
    A = []
    for _ in range(K):
        d = int(input())
        a = list(map(int, input().split()))
        D.append(d)
        A.append(a)
    ans = 0
    for i in range(N):
        flag = 0
        for j in range(K):
            if i+1 in A[j]:
                flag = 1
        if flag == 0:
            ans += 1
    print(ans)
resolve()

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

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

Solution (Python):
import sys
read = sys.stdin.readline
import time
import math
import itertools as it
def inp():
    return int(input())
def inpl():
    return list(map(int, input().split()))
start_time = time.perf_counter()


N, K = inpl()
dp = [False] * N
for i in range(K):
    d = inp()
    A = inpl()
    for a in A:
        dp[a-1] = True
cnt = 0
for bl in dp:
    if not bl:
        cnt += 1
print(cnt)


end_time = time.perf_counter()
print('time:', end_time-start_time, file=sys.stderr)

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
        
count = 0        
for i in range(n):
    if l[i] == 0:
        count += 1
print(count)

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

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())
a = set()
for i in range(k):
    d = int(input())
    a |= set(map(int, input().split()))
print(len(set(range(1, n + 1)) - a))

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

l = [0]*N
for d, a in DA:
    for ai in a:
        ai = ai-1
        l[ai] += 1

print(l.count(0))

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

Solution (Python):





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

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


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

print (ans)

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

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

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

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

while n <= N:
     a = a + [n]
     n += 1
for i in range(K):
     d = int(input())
     A = list(map(int,input().split()))
     for j in range(d):
          if A[j] in a:
               a.remove(A[j])
ans = len(a)
print(ans)

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

table = {l for l in range(1, N + 1)}
have = set()

for i in range(K):
    d = int(input())
    nums = list(map(int, input().split(' ')))
    have = have | set(nums)

ans = len(table - have)

print(ans)

Solution (Python):

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

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

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

print(ans)

Solution (Python):
import sys

N,K = map(int,input().split())
array = [ a for a in range(1,N+1) ]

for I in range(K):
    _ = input()
    sweets = list(map(int,input().split()))
    for K in sweets:
        if K in array:
            array.remove(K)
print(len(array))

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

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

for i in range(1,n+1):
    l.append(i)

ans = set(b)^set(l)
print(len(set(ans)))

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

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

print(sunuke.count(0))

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

if __name__ == "__main__":
  main()

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

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

if __name__ == "__main__":
    main()

Solution (Python):
import itertools

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

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

Solution (Python):
N,K = map(int,input().split())
a = [list(map(int,input().split())) for i in range(2*K)]
s = []; t = 0
for i in range(K):
    s = s + a[2*i+1]
for i in range(1,N+1):
    if i not in s:
        t+=1
print(t)

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

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

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

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

for a in A:
    for i in a:
        DB[i-1]+=1

ans=0

for db in DB:
    if db==0:
        ans+=1

print(ans)

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

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

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

print(ans)

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

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

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):
def line():
	return [int(i) for i in input().split(" ")]
n, k = line()
vis = [0 for i in range(n)]
for _ in range(k):
	line()
	for i in line():
		vis[i-1] = 1
print(vis.count(0))

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

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

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

ans = 0

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

print(ans)

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

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

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

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

print(l.count(0))

Solution (Python):


def main():
    N, K = map(int, input().split())
    matrix = [list(map(int, input().split())) for i in range(2*K)]
    sunuke = [0]*(N+1)
    for i in range(K):
        for j in matrix[2*i+1]:
            sunuke[j] += 1
    ans = sunuke.count(0) -1

    return ans

if __name__ == '__main__':
    
    print(main())

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

for i in range(n):
    sunuke.append(1)

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

print(sum(sunuke))

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


sum_A=[]

for i in range(K):
  for j in range(d[i]):
    sum_A.append(A[i][j])

ans = N - len(set(sum_A))

print(ans)

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

Solution (Python):
N, K = map(int, input().split())
sunuke = [0] * N
for i in range(K):
    di = int(input())
    Ai = map(int, input().split())
    for a in Ai:
        sunuke[a - 1] += 1
answer = 0
for s in sunuke:
    if s == 0:
        answer += 1
print(answer)

Solution (Python):


numbers = input().split(" ")
n = int(numbers[0])
k = int(numbers[1])
have_okashi = [0] * n
r = 0

for i in range(k):
  input()
  numbers = input().split(" ")
  for x in numbers:
    have_okashi[int(x) - 1] = 1


print(have_okashi.count(0)  )

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

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

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

s = [1] * n

for an in a:
  for j in an:
    s[j-1] = 0

print(sum(s))

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

Solution (Python):
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, K = map(int, readline().split())
A_all = []
for i in range(K):
    d = int(readline())
    A = list(map(int,readline().split()))
    A_all += A
set(A_all)
cnt = 0
for i in range(1,N+1):
    if i not in A_all:
        cnt +=1
print(cnt)

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

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

a = set(sum(a,[]))
ans = set(ns) - a
print(len(ans))

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

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

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

print(sunuke.count(0))

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

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

count = [0]*(n+1)
count1 = 0

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

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

print(count1)

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

hum_can = [[] for _ in range(n)]

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

print(hum_can.count([]))

Solution (Python):

from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


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

    have = [0 for i in range(N)]
    for _ in range(K):
        D = int(input())
        A = list(map(int, input().split()))
        for a in A:
            have[a - 1] = 1

    print(N - sum(have))


def main():
    solve()


if __name__ == '__main__':
    main()