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):
a,b = map(int,input().split())
w = []
t = {}
for i in range(b):
    c = int(input())
    s = list(map(int,input().split()))
    w +=s
t = set(w)
print(a-len(t))

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

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

print(sum(P))

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

Solution (Python):
n, k = map(int, input().split())
s = set()
for _ in range(k):
    tmp = int(input())
    arr = list(map(int, input().split()))

    for a in arr:
        s.add(a)

print(n - len(s))

Solution (Python):

n,k=map(int,input().split())
cnt=[0]*(n+1)
for j in range(k):
  tmp = int(input())
  arr=list(map(int,input().split()))
  for val in arr:
    cnt[val]+=1
ans=0
for i in range(1,n+1):
  if cnt[i]==0:
    ans+=1
print(ans)

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

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

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

s = [i for i in range(1,n+1)]
for _ in range(k):
  d = int(input())
  arr = list(map(int, input().split()))
  for a in arr:
    if a in s:
	    s.remove(a)
print(len(s))

Solution (Python):
N, K = map(int, input().split())
count = 0
num_people = []
num_people_snacks = []
for i in range(1, N + 1):
    num_people.append(i)

while K > count:
    d = int(input())
    A = list(map(int, input().split()))
    for k in A:
        num_people_snacks.append(k)
    count += 1

ans = 0
for j in range(N):
    if num_people[j] not in num_people_snacks:
        ans += 1
        
print(ans)

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

for i in range(K):
    d = int(input())
    if d > 0:
        a = list(map(int, input().split()))
        for v in a:
            x[v] += 1



c = 0
for i in range(1, N+1, 1):
    if x[i] == 0:
        c += 1

print(c)

Solution (Python):
import sys
from collections import deque, defaultdict, Counter
from itertools import accumulate, product, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right
from heapq import heappop, heappush
from math import ceil, floor, sqrt, gcd, inf
from copy import deepcopy
import numpy as np
import scipy as sp

INF = inf
MOD = 1000000007

n, k = [int(i) for i in input().split()]
d = []
A = []
for i in range(k):
    d.append(int(input()))
    A.append([int(i) for i in input().split()])

tmp = [True for i in range(n + 1)]
res = 0

for i in range(k):
    for j in range(d[i]):
        tmp[A[i][j]] = False
for i in range(1, n + 1):
    if tmp[i]:
        res += 1

print(res)

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

sunuke = [1] * N

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

Solution (Python):
import math
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(map(int, input().split()))
def i_row(N): return [int(input()) for _ in range(N)]
def i_row_list(N): return [list(map(int, input().split())) for _ in range(N)]

mnum,snum=i_map()
snholder=set()
for i in range(snum):
    d=i_input()
    ls=i_list()
    snholder=snholder | set(ls)
print(mnum-len(snholder))

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

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

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

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

candy = [0 for i in range(N)]
for i in range(K):
  for j in range(d[i]):
    candy[A[i][j]-1] += 1
print(candy.count(0))

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

Solution (Python):
N, K = (int(x) for x in input().split())
listN = [1] * N

for i in range(K):
    d = int(input())
    tmp = map(int, input().split())
    for j in tmp:
        listN[j-1] = 0
print(sum(listN))

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

sunuke = [1] * n

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

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

s = {i:0 for i in range(n+1)} 

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

cnt = -1

for i in s:
  if s[i] == 0:
    cnt +=1

print(cnt)

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

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

s[0] += 1
print(s.count(0))

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

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

cnt = 0        
for k in range(1,n+1):
    if s[k] == 0:
        cnt += 1
        
print(cnt)

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

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

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

dst = [1] * N

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

    for j in range(d):
        dst[A[j]-1] = 0

print(sum(dst))

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=list(itertools.chain.from_iterable(A))

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

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

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

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

ans = [0]*100

for i in range(k):
    for j in range(d[i]):
        ans[a[i][j]-1] = 1

print(n-sum(ans))

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

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 a:
        sunuke[i-1] += 1

print(sunuke.count(0))

Solution (Python):
def main() -> None:
    n, k = map(int, input().split())

    check = [0] * n
    for _ in range(k):
        _ = input()
        having = tuple(map(int, input().split()))
        for idx in having:
            check[idx-1] += 1
    print(check.count(0))
    return


if __name__ == '__main__':
    main()

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

sunuke = [0] * N
for i in range(K):
    for j in range(d[i]):
        sunuke[A[i][j] - 1] += 1

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

print(ans)

Solution (Python):

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

okasi = [0]*N 


for k in range(K):
    num = int(input()) 
    have = [int(i) for i in input().split()]
    for snuke in have:
        okasi[snuke-1] = num


print(okasi.count(0))

Solution (Python):
if __name__ == '__main__':

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

    A = [0] * n

    for _ in range(k):
        m = int(input())
        B = list(map(int,input().split()))
        for b in B:
            A[b-1] += 1
    print(A.count(0))

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

Solution (Python):
N,K=list(map(int, input().split()))
A=[0]*(N+1)
for _ in range(K):
  k=int(input())
  a=list(map(int, input().split()))
  for i in a:
    A[i]+=1
c=0
for i in range(1,N+1):
  c+=not A[i]
print(c)

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

print(l.count(0))

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

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

Solution (Python):
n, k = map(int, input().split())
snukes = []
for _ in range(k):
    okashi = int(input())
    snukes += [int(v) for v in input().split()]
target = 1
cnt = 0
l = list(set(snukes))
s = [int(v) for v in range(1, n + 1)]

for p in s:
    if p not in l:
        cnt += 1
print(cnt)

Solution (Python):
def N():
    return int(input())
def L():
    return list(map(int,input().split()))
def NL(n):
    return [list(map(int,input().split())) for i in range(n)]
mod = pow(10,9)+7

n,k = L()
l = [1]*n
for i in range(k):
    d = N()
    a = L()
    for j in a:
        l[j-1] = 0
print(l.count(1))

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

for i in range(k):
    d = int(input())
    l+=map(int,input().split())
print(n-int(len(set(l))))

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

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

Solution (Python):
import itertools
n,k = map(int,input().split())
ans = 0
l = []
for i in range(k) :
    d = int(input())
    l.append(input().split())

l = list(itertools.chain.from_iterable(l))
l = [int(i) for i in l]

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

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

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

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

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

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

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

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

    for j in range(d):
        sunukes[aa[j] - 1] += 1

count = sum(1 for sunuke in sunukes if sunuke == 0)

print(count)

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

print(n - len(a))

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

for _ in range(K):
    d = int(input())
    temp = list(map(int,input().split()))
    for j in temp:
        sunuke[j-1]+=1

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

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

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())))
cnt=[0 for i in range(N)]
for i in range(K):
    for a in A[i]:
        cnt[a-1]+=1
print(cnt.count(0))

Solution (Python):
from collections import Counter

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

has_sweet = [False] * N

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

c = Counter(has_sweet)
print(c[False])

Solution (Python):
N,K=map(int,input().split())
A=[]
people=list(range(1,N+1,1))
for idx in range(K):
    d=int(input())
    X=list((map(int,input().split())))
    for i in range(len(X)):
        A.append(X[i])
ans =[i for i in people if not i in A]
print(len(ans))

Solution (Python):
N,K=map(int,input().split())
s = set(range(1, N+1))
for i in range(K):
    d = int(input())
    A = list(map(int,input().split()))
    for x in A:
        try:
            s.remove(x)
        except:
            pass
print(len(s))

Solution (Python):
import sys

input=sys.stdin.buffer.readline





def RD(): return sys.stdin.read()


def II(): return int(input())


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


def MF(): return map(float,input().split())


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


def LF(): return list(map(float,input().split()))


def TI(): return tuple(map(int,input().split()))



import numpy as np

def main():
	n,k=MI()
	s=set()
	for _ in range(k):
		d=II()
		A=set(LI())
		s|=(A)
	print(n-len(s))
	
	









if __name__=="__main__":
	main()

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

for i in range(k):
    input()
    
    A_dup += list(map(int, input().split()))
A_eldup = list(set(A_dup))

for i in range(1, n+1):
    if i not in A_eldup:
        cnt += 1
print(cnt)

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

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

d = []
A = []

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

vec = [0] * N

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

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

print(ans)

Solution (Python):
from collections import defaultdict
n, k = map(int, input().split())
m = defaultdict(int)

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

result = 0
for i in range(1, n+1):
  if m[i] == 0:
    result += 1
print(result)

Solution (Python):
import sys

input = sys.stdin.readline
N, K = map(int, input().split())
cnt = [0]*N
for _ in range(K):
    d = int(input())
    for a in list(map(int, input().split())):
        a -= 1
        cnt[a] += 1

ans = 0
for c in cnt:
    ans += c == 0
print(ans)

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

s = []

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

for i in range(n):
    for k in range(a):
        if i + 1 == t[k]:
            x -= 1
            break
        elif i + 1 < t[k]:
            break
        
print(x)

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

table = [0] * N
for _ in range(K):
  num = int(input())
  have_list = list(map(int, input().split()))
  for child in have_list:
    table[child-1] += 1

print(str(table.count(0)))

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

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

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

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


print(C.count(0)-1)

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

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

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

Solution (Python):
from collections import Counter
import itertools
n, k = map(int, input().split())
d = []
sunuke = []
for i in range(k):
    d.append(int(input()))
    sunuke.append(list(map(int, input().split())))

new = list(itertools.chain.from_iterable(sunuke))

c = Counter(new)

print(n - len(c))

Solution (Python):
n,k=map(int,input().split());s={*range(1,-~n)}
for _ in range(k):
 input();s-={*map(int,input().split())}
print(len(s))

Solution (Python):
n,k=map(int,input().split());s=set(range(1,-~n))
for _ in range(k):
 input();s-=set(map(int,input().split()))
print(len(s))

Solution (Python):
n,k=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(d):
  sunuke[a[j]-1]+=1
  
ninnzuu=0

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

Solution (Python):

N, K = list(map(int, input().split()))
A = []
for i in range(K):
    d = int(input())
    a = []
    if d > 1:
        a = list(map(int, input().split()))
        A.extend(a)
    else:
        A.append(int(input()))
        
print(N - len(set(A)))

Solution (Python):


if __name__ == '__main__':
    N, K = map(int, input().split())

    sunuke = [0] * N
    

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

        for j in range(D):
            sunuke[li[j] - 1] += 1
            

    print(sunuke.count(0))

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


l = [0]*N
for i in range(K):
  for j in range(D[i]):
    l[A[i][j]-1] = 1

print(N - sum(l))

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


l = [0]*N
for i in range(K):
  for j in range(D[i]):
    l[A[i][j]-1] +=1

print(l.count(0))

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

has_snack = [False]*N

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

print(sum([1 for h in has_snack if h == False]))

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

treat = [0] * N

for _ 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):
n,k=map(int,input().split())
d=[0]*k
A=[]

for i in range(k):
    d=int(input())
    A+=list(map(int,input().split()))
    list(set(A))
cnt=0
for i in range(n):
    if i+1 not in A:
        cnt+=1
print(cnt)

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

print(answer)

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

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

for members in A:
    for member in members:
        sunuke[member - 1] = 1

print(N - sum(sunuke))

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

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

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

a = set()
ans = 0
for i in range(K) :
    for j in range(len(A[i])) :
        a.add(A[i][j])

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

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

Solution (Python):


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

r=0
for i in range(n):
  if sum(s[i])==0:
    r=r+1
print(r)

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

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

print(ans)

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

ans = [0] * (n + 1)
for i in range(k):
  for j in range(d[i]):
    
    ans[a[i][j]] += 1
c = 0
for i in range(1,n + 1):
  if ans[i] == 0:
    c += 1
print(c)

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

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

AAA = list(set(AAA))

AA = []
for i in range(N):
    AA = AA + [i + 1]

a = AAA + AA
ANS = len([i for i in list(set(a)) if a.count(i) == 1])

print(ANS)

Solution (Python):
n, k = map(int, input().split())
count = [0] * n
for _ in range(k):
    kosu = int(input())
    pos = list(map(int, input().split()))
    for i in pos:
        count[i-1] +=1
ans = [True if i == 0 else False for i in count]
print(sum(ans))

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

Solution (Python):

def main():
    n, k = map(int, input().split(" "))
    s =set()
    for i in range(k):
        _ = input()
        a = list(map(int, input().split(" ")))
        for j in range(len(a)):
            s.add(a[j])
    print(n - len(s))

if __name__ == "__main__":
    main()

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

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)
  l = list(set(l))

print(n - len(l))

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

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

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

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

Solution (Python):
n,k = map(int,input().split())
temp = [False for i in range(n)]
for i in range(k):
    x = int(input())
    y = list(map(int,input().split()))
    for j in y:
        if not temp[j-1]:
            temp[j-1] = True

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

Solution (Python):
N ,K = map(int ,input().split())
num = set()
for i in range(K):
    d = input()
    num.update(int(x) for x in input().split())

sum = 0
for k in num:
    sum += 1
print(N-sum)

Solution (Python):
nk = input().split()
n = int(nk[0])
k = nk[1]
l = []

for i in range(int(k)):
    num = int(input())
    sweet = input().split()
    for j in range(num):
        sw = int(sweet[j])
        l.append(sw)

l = list(set(l))

ass = len(l)

ans = n - ass

print(ans)

Solution (Python):
a,b=map(int,input().split())
e=[]
for _ in range(b):
  c=int(input())
  d=list(map(int,input().split()))
  for i in d:
    e.append(i)

f=set(e)
print(a-len(f))

Solution (Python):
a,b=map(int,input().split())
e=[]
for _ in range(b):
    c=int(input())
    d=list(map(int,input().split()))
    for i in d:
        e.append(i)

f=set(e)
print(a-len(f))

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

li = []
for i in range(k) :
  gomi = input()
  [li.append(int(j)) for j in input().split()]
st = set(li)
  
print(n - len(st))

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

li = []
for i in range(k) :
  gomi = input()
  [li.append(int(j)) for j in input().split()]
st = set(li)
  
ans = 0
for i in people :
  if not i in st :
    ans += 1
print(ans)

Solution (Python):
if __name__ == '__main__':
    N, K = map(int, input().split())
    have_snack = []
    for i in range(K):
        n = int(input())
        have_snack.extend(list(map(int, input().split())))
    ans = N - len(set(have_snack))
    print(ans)

Solution (Python):
import itertools
n,k = map(int, input().split())
di = [0] * k
Ai_di = []
for i in range(k):
    di[i] = int(input())
    Ai_di.append(list(map(int, input().split())))
ans_set = set(list(itertools.chain.from_iterable(Ai_di)))
print(n - len(ans_set))

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

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

    for a in A:
        cnts[a-1] += 1
cnt = 0
for c in cnts:
    if c == 0:
        cnt += 1
print(cnt)

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

for i in range(1,n+1):
    if i not in l:
        cnt+=1

print(cnt)

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

m = [0]*n

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

print(m.count(0))

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

d=[]
a=[]

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

c=list(itertools.chain.from_iterable(a))
c.sort()

c_set=set(c)
c=list(c_set)

print(n-len(c))

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

for _ in range(K):
    d = int(input())
    A = map(int, input().split())
    for x in A:
        S[x-1] = True

print(sum(1 for x in S if not x))

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

for i in range(k):
  d = int(input())
  p = list(map(int,input().split()))
  for j in p:
    list1.append(j)
    
count = 0
for m in range(1,n+1):
  if m not in list1:
    count += 1
    
print(count)

Solution (Python):

from itertools import chain






def solve(N, A):
    sunukes = [1 for _ in range(N)]
    for a in A:
        for i in a:
            sunukes[i-1] = 0
    return sum(sunukes)

def main():
    N, K = map(int, input().split())
    A = []
    for k in range(K):
        _ = int(input())
        A.append(list(map(int, input().split())))

    answer = solve(N, A)



    print(answer)

if __name__ == '__main__':
    main()

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

for k in range(K):
    d = int(input())
    S = list(map(int, input().split()))
    for s in S:
        okasi[s - 1] = 0

print(sum(okasi))

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

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

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

S = [0] * N

for _ in range(K):
    snack = int(input())
    snukes = [int(v) for v in input().split()]
    for snuke in snukes:
        S[snuke-1] = 1

print(sum(x == 0 for x in S))

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

Solution (Python):
def main():
    nk = [int(_x) for _x in input().split()]
    N = nk[0]
    K = nk[1]

    snuke = [True]*N

    for i in range(K):
        input()
        aa = [int(_x) for _x in input().split()]
        for a in aa:
            snuke[a-1] = False
    print(sum(snuke))


main()

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

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

print(sum([1 if x == 0 else 0 for x in xs]))