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

sunuke = [0 for i in range(n)]

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

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

print(ans)

Solution (Python):
from collections import defaultdict

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

dict = defaultdict(lambda: 0)

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

print(N-len(dict))

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

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

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

for i in range(k):
    d_i = int(input())
    D = [int(x) for x in input().split()]
    for j in D:
        ans[j-1] += 1

count = 0
for a in ans:
    if a == 0:
        count += 1
print(count)

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

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

print(okasi.count(0))

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

L = [0 for i in range(N+1)]

for i in range(K):
  d = int(input())
  LL = list(map(int, input().split()))
  for j in range( len(LL) ):
    L[ LL[j] ] += 1

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

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

Solution (Python):
import sys
import math
from collections import Counter
import itertools
import fractions



def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())

def LI(): return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SR(): return sys.stdin.readline().rstrip()

ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_uppercase2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'


p2D = lambda x: print(*x, sep="\n")
p2E = lambda x: print(''.join(x))
p2S = lambda x: print(*x, sep=" ")


 
N,K=MI()
d=[0]*K
A=[0]*K

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

s=set()
for a in A:
    for z in a:
        s.add(z)
ans=0
for i in range(1,N+1):
    if not i in s:
        ans+=1
print(ans)

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

print(t.count(0))

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

for i in range(k):
    d = int(input())
    l = list(map(int, input().split()))
    for x in l:
        ate.add(x)

print(n - len(ate))

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

no_treat = [True] * (N + 1)

for _ in range(K):
    _ = input()
    A = list(map(int, input().split()))
    for a in A:
        no_treat[a] = False

ans = -1

for snuke in no_treat:
    if snuke:
        ans += 1

print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 6)

int1 = lambda x: int(x) - 1
def II(): return int(input())

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

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

INF = float('inf')

def solve():
    n, k = MI()
    S = [1] * n
    for i in range(k):
        d = II()
        A = LI1()
        for a in A:
            S[a] = 0
    
    print(sum(S))



if __name__ == '__main__':
    solve()

Solution (Python):



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

list_sunuke = []

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

print(n-len(set(list_sunuke)))

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

Solution (Python):
N, K = [int(x) for x in input().strip().split(" ")]
has_ = []
for _ in range(K):
    int(input().strip())
    has_ += [int(x) for x in input().strip().split(" ")]
print(N - len(set(has_)))

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

H = [0] * N

for i in range(K):
    input()
    for v in [int(t) for t in input().split()]:
        H[v - 1] += 1

print(H.count(0))

Solution (Python):
from collections import defaultdict
s = list(map(int,input().split()))
n=s[0]
k=s[1]
sunu={}
for i in range(1,n+1):
    sunu[i]=0
for i in range(k):
    s = list(map(int, input().split()))
    d=s[0]
    s = list(map(int, input().split()))
    for j in s:
        sunu[j]+=1
ans=0
for i in sunu:
    if sunu[i]==0:
        ans+=1
print(ans)

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

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

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

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

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

Solution (Python):




def main():
    
    N, K = list(map(int, input().split()))
    d = {}
    result = {i: False for i in range(N)}
    for k in range(K):
        d = int(input())
        A = list(map(int, (input().split())))
        for a in A:
            result[a-1] = True
    count = 0
    for n in range(N):
        if result[n] == False:
            count += 1
    print(count)
    pass

if __name__ == '__main__':
    main()

Solution (Python):
import sys
import math

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




sunuke=list()
for i in range(N):
    sunuke.append(0)

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

    for j in range(d):
        sunuke[A[j]-1] += 1

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

print(n)

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

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

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

print(N-sum(P))

Solution (Python):
from sys import stdin
import sys


N, K = [int(x) for x in stdin.readline().rstrip().split()]
ans = [0 for i in range(N)]
for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for i in range(len(A)):
        ans[A[i]-1] += 1
cnt=0
for i in range(len(ans)):
    if ans[i] == 0:
        cnt += 1
print(cnt)

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

d = []
a = []

for i in range(k):
    temp = int(input())
    d.append(temp)

    t = list(map(int,input().split()))
    a.append(t)


a_set = set()
for i in a:
    for j in i:
        a_set.add(j)

print(n - len(a_set))

Solution (Python):
N, K = map(int, input().split())
Ni = [0 for i in range(N)]
for j in range(K):
    di = int(input())
    Ai = list(map(int, input().split()))
    for x in Ai:
        Ni[x - 1] = 1

print(Ni.count(0))

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

for i in range(K):
    d = input()
    temp_ = list(map(int, input().split()))
    for i in range(len(temp_)):
        nlist.add(temp_[i])
N_ = len(nlist)
print(N - N_)

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

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

print(N-len(set(okashi)))

Solution (Python):
def main():
    n, k = map(int, input().split())
    d, A = [], []
    for _ in range(k):
        d.append(int(input()))
        l = list(map(lambda x:int(x) - 1, input().split()))
        A.append(l)

    ans = solve(n, k, d, A)
    print(ans)


def solve(n, k, d, A):
    sunuke = [False for _ in range(n)]
    for l in A:
        for i in l:
            sunuke[i] = True
    ans = [1 for i in sunuke if i == False]
    return sum(ans)


if __name__ == '__main__':
    main()

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

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

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

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

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

print(ans)

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

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

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

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

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

print(count)

Solution (Python):
n, k = map(int, input().split())
snuke = [0 for _ in range(n)]
for i in range(k):
    how = int(input())
    snack = list(map(int, input().split()))
    for j in snack:
        snuke[j - 1] = 1

print(n - sum(snuke))

Solution (Python):

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

Solution (Python):
inp_ls = input().split(" ")
n,k = [int(e) for e in inp_ls[:2]]

sunuke = [1 for _ in range(n)]
for i in range(k):
	d = int(input())
	a_ls = [int(e) for e in input().split(" ")[:d]]
	for a in a_ls:
		sunuke[a-1] = 0

print(sum(sunuke))

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

ans=[0]*n
for i in range(k):
    for j in range(len(a[i])):
        if ans[a[i][j]-1]==0:
            ans[a[i][j] - 1]=1
cnt=0
for i in range(n):
    if ans[i]==0:
        cnt+=1

print(cnt)

Solution (Python):
n, k = map(int, input().split())
have = [False] * 101

for i in range(k):
    d = map(int, input())
    ds = map(int, input().split())
    for j in ds:
        have[j-1] = True

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

print(count)

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

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

sunulist = [1] * N

for i in range(K):
    di = dA[i][0]
    for j in range(di):
        m = dA[i][1][j]
        sunulist[m - 1] = 0

print(sum(sunulist))

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

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

b=[]
for t in a:
  for tt in t:
    b.append(tt)

a = set(b)
n = 0

for i in range(1, N+1):
  if i not in a:
    n += 1

print(n)

Solution (Python):
import numpy as np

x = input().split()

n = int(x[0])
k = int(x[1])
ds = []
bool_array = [0]*n

for num in range(k):
  di = int(input())
  ajs_input = input().split(' ')
  for j in range(di):
     bool_array[int(ajs_input[j])-1] = 1
      
print(n - np.array(bool_array).sum())

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

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

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

print(len(list(filter(lambda x:x==0,a)))-1)

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

print(a.count(0))

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

    for i in range(K):
        d = int(input())
        O = [int(a) for a in input().split()]

        for j in range(d):
            A[O[j]-1] += 1
    cnt = 0
    for i in range(N):
        if A[i] == 0:
            cnt += 1

    print(cnt)
            
if __name__ == "__main__":
    main()

Solution (Python):
import itertools

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

Solution (Python):


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

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

ln = [1] * (n+1)

ln[0] = 0

for a in la:
    for s in a:
        ln[s] = 0

print(sum(ln))

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

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

for i in range(K):
    input()
    li = list(map(int, input().split()))
    for j in li:
        N_li[j-1] = 1

print(N - sum(N_li))

Solution (Python):
n,m=map(int,input().split( ))
p=[i for i in range(1,n+1)]
for i in range(m):
    d=int(input())
    q=list(map(int,input().split( )))
    for j in q:
        if j in p:
            p.remove(j)
print(len(p))

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

Solution (Python):

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

    BL = [False]*N
    for _ in range(K):
        d = int(input())
        for i in input().split():
            i = int(i)-1
            BL[int(i)] = True

    print(sum([1 for x in BL if x==False]))

if __name__ == "__main__":
    resolve()

Solution (Python):



from collections import defaultdict, Counter
from functools import lru_cache
from heapq import heappush, heappop
from math import gcd, floor, ceil
from sys import stdin, stdout

def ilist():
    return [int(x) for x in stdin.readline().strip().split(" ")]
def iint():
    return int(stdin.readline().strip())
def istr():
    return stdin.readline().strip()



def solve():
    pass


if __name__ == '__main__':
    N, K = ilist()
    di = [0] * (N + 1)
    for _ in range(K):
        d = iint()
        A = ilist()
        for i in range(d):
            di[A[i]] = 1
    print(N - sum(di))

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

Solution (Python):


N, K =  [int(i) for i in input().split()]

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

Solution (Python):
n, k = map(int, input().split())
a = [0 for _ in range(n)]
for _ in range(k):
    _ = input()
    d_i = list(map(int, input().split()))
    for a_j in d_i:
        a[a_j-1] += 1

print(a.count(0))

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

def main():
    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)))

if __name__ == '__main__':
    main()

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

d = {}
for i in range(1, k+1):
    _ = input()
    A = map(int, input().split(" "))
    for a in A:
        tmp = d.get(a, [])
        tmp.append(i)
        d[a] = tmp

ans = 0
for i in range(1, n+1):
    if i not in d:
        ans = ans + 1

print(ans)

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

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

Solution (Python):
n, d = map(int, input().split())
res_list = [0] * n
for i in range(d):
  input()
  s_list = list(map(int, input().split()))
  for val in s_list:
    res_list[val-1] += 1
res = 0
for r in res_list:
  if r == 0:
    res += 1
print(res)

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

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

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

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

Solution (Python):
n, k = map(int, input().split())
have = [False] * n
for i in range(k):
    _ = int(input())
    a = list(map(int, input().split()))
    for a_elem in a:
        have[a_elem - 1] = True
print(sum([not h for h in have]))

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

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

Solution (Python):
import sys

N, K = map(int, sys.stdin.readline().rstrip().split())

counter = [0] * N

for k in range(K):
    d = int(sys.stdin.readline().rstrip())
    A = list(map(int, sys.stdin.readline().rstrip().split()))
    for a in A:
        counter[a - 1] += 1

print(counter.count(0))

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

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

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

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

ans = 0
for item in snukes_snacks:
	if len(item) == 0:
		ans += 1
print(ans)

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

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

Solution (Python):
def B():
    N, K = map(int, input().split())
    snukes = set([i for i in range(1, N+1)])
    seen = set()
    for i in range(K):
        d = int(input())
        seen = seen.union(set([int(n) for n in input().split()])) 
    print(len(snukes.difference(seen)))
        
B()

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

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

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

cnt = 0
for row in A:
    if not any(row):
        cnt += 1

print(cnt)

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

import itertools


judge_list = set(list(itertools.chain.from_iterable(A)))
count=0
for i in range(N):
    if (i+1) in judge_list:
        continue
    else:
        count+=1

print(count)

Solution (Python):
from collections import Counter
N, K = map(int, input().split())
result = []
for _ in range(K):
    d = input()
    A = list(map(int, input().split()))
    result += A
A = Counter(result)
print(len([i for i in range(1, N+1) if i not in A]))

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

print(N -len(set(num)))

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

print(ans.count(0))

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

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

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

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

d = []
a = []

for i in range(2 * k):
    if i % 2 == 0:
        d.append(ls[i])
    elif i % 2 == 1:
        a.append(ls[i])


cnt = [0] * n

for j in range(k):
    for ajd in a[j]:
        cnt[ajd - 1] += 1

print(cnt.count(0))

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

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

h = {}

for i in range(K):
    tmp = int(input())
    for j in map(int, input().split()):
        if j in h:
            h[j] += 1
        else:
            h[j] = 1

print(N - len(h.keys()))

Solution (Python):
[n, k] = [int(s) for s in input().split()]
a = [0 for _ in range(n)]
for _ in range(k):
    input()
    for n in [int(s) for s in input().split()]:
        a[n-1] = 1
print(len([1 for b in a if b == 0]))

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

Solution (Python):
N, K = map(int, input().split())
foods = [[] for _ in range(N)]
for _ in range(K):
    d = int(input())
    food = list(map(int, input().split()))
    for human in food:
        foods[human - 1].append(d)

count = 0
for food in foods:
    if len(food) == 0:
        count += 1

print(count)

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

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

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

Solution (Python):
n,k = map(int,input().split())
ans = {}
for i in range(k):
    di=int(input())	
    li = list(map(int,input().split()))
    for l in li:
        ans[str(l)] = "0"
count = 0
for i in range(1,n+1):
    if str(i) not in ans.keys():
        count += 1
print(count)

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

sunuke = [0] * n
for i in range(k):
    for j in A[i]:
        sunuke[j - 1] += 1

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

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

all_ch = set(range(1, N+1))
have_snack = set()
for i in range(K):
    _ = input()
    kid_have_sn_arr = list(map(int, input().split(" ")))
    for id in kid_have_sn_arr:
        have_snack.add(id)

donthave = all_ch - have_snack
print(len(donthave))

Solution (Python):

import collections
import itertools as it
import math

 


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





snuke = [0] *n

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

ans = 0
for snuke_ in snuke:
    if snuke_ == 0:
        ans += 1

print(ans)

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

Solution (Python):

"""
@author: H_Hoshigi
"""
def main():
    N, K = map(int, input().split())
    sunuke_list = [0 for i in range(N)]
    for i in range(K):
        d = int(input())
        A_list = list(map(int, input().split()))
        for a in A_list:
            sunuke_list[a-1] += 1
    answer = 0
    for sunuke in sunuke_list:
        if sunuke == 0:
            answer += 1
    print(answer)

if __name__ == "__main__":
    main()

Solution (Python):


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

mem=[0]*N

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

print(mem.count(0))

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

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

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

print(li.count(False))

Solution (Python):
N,K = map(int,input().split())
counter = [0 for _ in range(N)]
for _ in range(K):
    _ = int(input())
    p = map(int,input().split())
    for i in p:
        counter[i-1] += 1
total = 0
for i in counter:
    if i == 0:
        total += 1
print(total)

Solution (Python):
import sys

input = sys.stdin.readline
MOD = 1000000007

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

a = [0]*(N)

for _ in range(K):
    d = int(input())

    if d == 1:
        x= int(input())
        x-=1
        a[x]+=1
    else:
        x = map(int,input().split())
        for i in x:
            i-=1
            a[i] +=1

print(a.count(0))

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

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

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 i in range(d):
        sunuke[a[i]-1] += 1

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

Solution (Python):
X=input().split(" ")
N=int(X[0])
K=int(X[1])
Nset=set(range(1,N+1))
for _ in range(K):
  d=input()
  dset=set(map(int,input().split(" ")))
  Nset-=dset
print(len(Nset))

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

sunuke = [ 0 ] * int(n)

for i in range( int( k ) ):
    d = int( input() )
    a = input().split()
    for a_i in a:
        sunuke[ int( a_i ) - 1 ] = 1

cnt = 0
for sunuke_i in sunuke:
    if sunuke_i == 0:
        cnt = cnt + 1

print( cnt )

Solution (Python):
n,k = map(int, input().split())
person = [1]*n
for i in range(k):
    _ = input()
    temp = input().split()
    for j in range(len(temp)):
        person[int(temp[j])-1] = 0

print(sum(person))

Solution (Python):
N, K = map(int, input().split())
ans = {i+1 for i in range(N)}
for i in range(K):
    d = int(input())
    a = set(map(int, input().split()))
    ans = ans - a

print(len(ans))

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

print(N - len(set(sunu)))

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

print(sunuke.count(1))