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())
d = 0
A = []
s = [0] * n
for i in range(k) :
    d = int(input())
    for j in range(d) :
        A = list(map(int,input().split()))
        for k in range(len(A)) :
            l = A[k]-1
            s[l] += 1
        break

    
print(s.count(0))

Solution (Python):
N, K = [int(i) for i in input().split()]
cnt = 0
sunuke_dict = {}
for i in range(1, N+1):
    sunuke_dict[i] = 0
    
while cnt < K:
    cnt += 1
    d = int(input())
    sunuke_list = [int(i) for i in input().split()]
    for sunuke in sunuke_list:
        sunuke_dict[sunuke] = 1

result = [key for key, value in sunuke_dict.items() if value == 0]
print(len(result))

Solution (Python):
N,K=input().split()
N=int(N)
K=int(K)
j=0
A=[]
for j in range(K):
    d=int(input())
    B=[int(x) for x in input().split()]
    k=0
    for k in range(d):
        A.append(B[k])
        k+=1
    A=list(set(A))
    j+=1
A=set(A)
a=len(A)
b=N-a
print(b)

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())))
ans=0
s=[]
for h in range(1,n+1):
    for i in range(k):
        for j in range(d[i]):
            if A[i][j] == h:
                if not h in s:
                    ans +=1
                    s.append(h)
    
print(n-ans)

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


peo=[]

for i in range(K):
    A=int(input())
    su=input().split()
    for k in range(A):
        peo.append(str(su[k]))

peo
print(N-len(set(peo)))

Solution (Python):
import itertools
n, k = map(int, input().split())
d = [0]*k
a = [0]*k
for i in range(k):
    d[i] = int(input())
    a[i] = list(map(int, input().split()))
a = list(set(list(itertools.chain.from_iterable(a))))
ans = 0
for i in range(1, n+1):
    if i in a:
        continue
    else:
        ans += 1

print(ans)

Solution (Python):
def main():
    n, k = map(int, input().split())
    cnt = [0]*101
    for _ in range(k):
        d = int(input())
        A_i = list(map(int, input().split()))
        for i in range(1, n+1):
            if i not in A_i:
                cnt[i] += 1
    res = 0
    for j in cnt:
        if j == k:
            res += 1
    print(res)

if __name__ == "__main__":
    main()

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

con = 0
ans = list(int() for _ in range(100000))
pre = 0


for _ in range(K):

    D = int(input())
    arr = list(map(int,input().split()))

    for j in range(D):

        ans[pre+j]=arr[j]

    pre += D

        
fin = (N+1) - len(set(ans))

print(fin)

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

A = [1 for i in range(N)]
d = [0 for i in range(K)]

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

print(sum(A))

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

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


num = A[1::2]

ans = []
for i in range(k):
    ans += num[i]

C = len(set(ans))
print(n-C)

Solution (Python):
n , k = map(int ,input().split())
n_all_list = []
cnt = 1
n_cnt = 0
while cnt <= k :
    d_x = int(input())
    n_list = map(int,input().split())
    n_all_list.extend(n_list)
    cnt += 1

set(n_all_list)
n_all_dict = {}
for i in range(1,n + 1):
    n_all_dict[i] = ""

for x in n_all_list :
    n_all_dict[x] = "exsit"

for i in n_all_dict.values():
    if i == "":
        n_cnt += 1

print(n_cnt)

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

for i in range(k):
    d = int(input())
    okashi_list = list(map(int,input().split()))
    for j in range(d):
        having = okashi_list[j] - 1
        if not hash_list[having]:
            hash_list[having] = True

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

print(count)

Solution (Python):
from collections import defaultdict
import sys
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9 + 7
eps = 10**-7


def inp():
    return int(input())


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


N, K = inpl()
tmpl = [0] * N
for k in range(K):
    d = inp()
    aa = inpl()
    for a in aa:
        tmpl[a - 1] += 1

ans = 0
for t in tmpl:
    if t == 0:
        ans += 1
print(ans)

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

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

Alist = [e for row in A for e in row]
        
L = len(list(set(Alist)))
print(N-L)

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

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

Solution (Python):
N,K = (int(x) for x in input().split())

taisho = set()
for j in range(K):
    d = int(input())
    A = [int(x) for x in input().split()]
    for k in range(d):
        if not A[k] in taisho:
            taisho.add(A[k])
cnt = 0
for i in range(N):
    if not i+1 in taisho:
        cnt += 1
print(cnt)

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

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

l = [e for row in l for e in row]
l = set(l)

cnt = 0
for i in range(n+1):
    for j in l:
        if i == j:
            cnt += 1

print(n-cnt)

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

hito = []
max = k*2
for i in range(k*2):
    a = list(map(int,input().split()))
    hito.append(a)

for i in range(k*2):
    if i % 2 == 1:
        h = hito[i]
        for j in h:
            A[j-1] += 1
ans = 0
for i in range(len(A)):
    if A[i] == 0:
        ans += 1
print(ans)

Solution (Python):


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

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

print(d.count(0))

Solution (Python):

s = input().split()

n = int(s[0])
k = int(s[1])

treat = []

for i in range(n):
    treat.append(False)

for i in range(k):    
    d = int(input())
    a = input().split()
    
    for j in range(d):
        treat[int(a[j]) - 1] = True
    
res = 0

for i in range(n):
    if not treat[i]:
        res += 1

print(res)

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


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

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


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

Solution (Python):
N,K = map(int,input().split())
A = [1]*N
import collections
for i in range(K):
  d = int(input())
  check = input().split()
  for j in range(d):
    if A[int(check[j])-1] == 1:
      A[int(check[j])-1] = 0
c = collections.Counter(A)
print(c[1])

Solution (Python):
data = input().rstrip().split(" ")
people = int(data[0])
kind = int(data[1])
ans = [i+1 for i in range(people)]
for j in range(kind):
    empty = input()
    have = input().rstrip().split(" ")
    for k in have:
        if int(k) in ans:
            delete = ans.index(int(k))
            del ans[delete]
print(len(ans))

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

d = []
a = []
res = [0] * n

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

for aa in a:
    for aaa in aa:
        res[aaa - 1] += 1

count = 0

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

print(count)

Solution (Python):

N, K = map(int, input().split() )
rt = []
for k in range(K):
    d = int(input())
    a = list(map(int, input().split() ) )
    rt += a
val = 0
for n in range(1, N+1):
    if n not in rt:
        val += 1
print(val)

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

for i in range(K):
    d = int(input())
    X = [int(i) for i in input().split()]
    A.extend(X)

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

Solution (Python):
n,k=map(int,input().split())
b=list(range(1,n+1))
a=[]

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

a=list(set(a))

ans=0
for i in b:
	if not i in a:
		ans += 1

print(ans)

Solution (Python):
def resolve():
    N, K = map(int, input().split())
    have_candy = []
    for i in range(K):
        d = int(input())
        A = map(int, input().split())
        have_candy.extend(A)
    print(N - len(set(have_candy)))

resolve()

Solution (Python):
n,k = map(int,input().split())
List = [list(map(int, input().split())) for i in range(2*k)]
List_a = []
for x in range(1,2*k,2):
    for i in List[x]:
        List_a.append(i)

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

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

lists = []
for i in range(k):
    d = input()
    a = input().split()
    lists.extend(a)

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

Solution (Python):
n,k = [int(ch) for ch in input().split()]
snuckList = []
for i in range(n):
    snuckList.append(i+1)
for i in range(k):
    cnt = int(input())
    snucks = [int(ch) for ch in input().split()]
    for snuck in snucks:
        if snuck in snuckList: 
            snuckList.remove(snuck)
print(len(snuckList))

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

setA = set(A)
sub = list(all_sunuke - setA)

print(len(sub))

Solution (Python):
import itertools
N, K = map(int, input().split())
i=0
dlist=[]
mlist=[]
while(i<K) :
  d = int(input())
  val = input().split()
  dlist.append(d)
  mlist.append(val)
  i+=1
res=0
list=list(itertools.chain.from_iterable(mlist))
if(N==1):
  if(list.count("1")==0):
    res+=1
else:
  j=1
  while(j<=N):
    if(list.count(str(j))==0):
      res+=1
    j+=1
print(res)

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

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

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

for _ in range(K):
    d = int(input())
    A = map(int, input().split())
    for a in A:
        earned[a] = earned[a] | 1
else:
    print("%d"%(N-sum(earned)))

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

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

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

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

print(count)

Solution (Python):
n_k = input().split(' ')

n = [0]*int(n_k[0])
k = int(n_k[1])

for k_ in range(k):
    d = int(input())
    l = input().split(' ')
    for d_ in range(d):
        n[int(l[d_])-1] += 1

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

print(count)

Solution (Python):
n = list(map(int,input().split()))
m= []
mm= []
nuke = []
for x in range(n[1]):
    m.append(int(input()))
    mm.extend(list(map(int,input().split())))

for i in range(n[0]):
    nuke.append(i+1)

mn = list(set(mm))

for l in range(len(mn)):
    if mn[l] in nuke:
        nuke.remove(mn[l])

print(len(nuke))

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

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

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

flat=[flatten for inner in li for flatten in inner]


B=len(flat)


for k in range(N):
        if k+1 in flat:
            pass
        else:
            ans=ans+1
        
print(ans)

Solution (Python):
n,k = map(int,input().split())
l = [0 for i in range(n)]
for _ in range(k):
    temp = int(input())
    d = list(map(int,input().split()))
    for i in d:
        l[i-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=[]
for i in range(k):
 d=int(input())
 a.append([])
 a[i]=input().split()
count=0
for i in range(1,n+1):
 for j in range(k):
  if a[j].count(str(i))!=0:
   count=count+1
   break
print(n-count)

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

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

sunuke = [int(i+1) for i in range(N)]

sulist = []

for j in range(M):
    K = int(input())
    P = [list(map(int,input().split()))]
    for i in sunuke:
      if i in P[0]:
        sulist.append(i)
print(N-len(set(sulist)))

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

Solution (Python):
def do():
    n,m=map(int,input().split())
    num=[]
    k=0
    for i in range(m):
        d=int(input())
        l=list(map(int,input().split()))
        num.extend(l)
    for i in range(1,n+1):
        if i not in num:
            k+=1
    return k


print(do())

Solution (Python):

n, k = map(int, input().split())
data = [list(map(int,input().split())) for i in range(k*2)]
d = data[0::2]
a = data[1::2]
a = ', '.join(map(str, a))
a = a.replace("[","")
a = a.replace("]","")
list_a = list(map(int, a.split(",")))
list_a = list(set(list_a))
ans = n - len(list_a)
print(ans)

Solution (Python):


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

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

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

N, K = map(int, input().split())
member_list = []
while input():
    arr = list(map(int, input().split()))
    
    member_list.extend(arr)

print(N-len(set(sorted(member_list))))

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

A = []
for k in range(K):
    d = int(input())
    a = list(map(int, input().split()))
    for x in range(d):
        A.append(a[x])
    
A = list(set(A))
print(N - len(A))

Solution (Python):
import os

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

if __name__ == "__main__":
        main()

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


sunuke = n * [0]
ans = 0

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

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

print(ans)

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

Solution (Python):
import sys

count = 0
N = 0
K = 0
Check = []

while True:

    try:
        S = input()
        count += 1
    except:
        print(N - sum(Check))
        break
	
    if count > 1 and count % 2 == 1:
      split = S.split()
      for i in range(len(split)):
        Check[int(split[i]) - 1] = True      
      
    if count == 1:
      split = S.split()
      N = int(split[0])
      K = int(split[1])
      for i in range(N):
        Check.append(False)

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

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

m = [False] * N

for a in A:
    for aa in a:
        m[aa - 1] = True

print(len([x for x in m if not x]))

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

np = [0] * n

for i in range(k):
    d = int(input())
    for x in input().split():
        np[int(x) - 1] += 1

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

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



L, R = map(int,input().split())
dell = set(range(1, L))
answer = set(range(1, L+1))

for x in range(R):
  intA = int(input())
  dell = list(map(int, input().split()))
  
  answer = answer.difference(dell)

print (len(answer))

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

for i in range(K):
  d = int(input())
  a_list = list(map(int, input().split()))
  n_list.extend(a_list)
  n_list = list(set(n_list))
print(len(list(set(ans_list)-set(n_list))))

Solution (Python):

n,k=map(int,input().split())
a=[]
cnt=0
for i in range(k):
    d=int(input())
    x=[int(e) for e in input().split()]
    for j in x:

        a.append(j)
a.sort()
for j in range(len(a)-1):
    if a[j]!=a[j+1]:
        cnt+=1
print(n-cnt-1)

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

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

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

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

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

print(ans)

Solution (Python):
n, k = (int(x) for x  in input().split())
l = []
la = l.append
for _ in range(k):
    input();la(list((int(x)for x in input().split())))
p = set(sum(l, []))
ans = 0
for x in range(1, n+1):
    if x not in p:
        ans += 1
print(ans)

Solution (Python):

import sys
s = sys.stdin.readlines()

n, k=map(int, s[0].split())

d=[]
A=[]

for i in s[1:2*k:2]:
    d.append(int(i))

for i in s[2:2*k+1:2]:
    A.append(list(map(int, i.split())))

from collections.abc import Iterable
def flatten(l):
    for el in l:
        if isinstance(el, Iterable) and not isinstance(el, (str, bytes)):
            yield from flatten(el)
        else:
            yield el

A_flat=list(flatten(A))

import collections
c = collections.Counter(A_flat)

print(n-len(list(c.keys())))

Solution (Python):

import itertools

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

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

allocate = list(itertools.chain.from_iterable(A))



l1_l2_sym_diff = []
l1_l2_sym_diff = set(allocate) ^ set(judge)
print(len(l1_l2_sym_diff))

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

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

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

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

S = range(1, N+1)

for _ in range(K):
    d = int(raw_input())
    A = map(int, raw_input().split())
    for a in A:
        if a in S:
            S.remove(a)

print len(S)

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

ans=[]
for i in range(1,n+1):
  if i not in(a):
    ans.append(i)
print(len(ans))

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

d = []
A = []
for i in range(K):
    d_pre = int(input())
    A_pre = [int(x) for x in input().split()]
    d.append(d_pre)
    A.extend(A_pre)

A_unique = list(set(A))

ans = 0

for i in range(1, N+1):
    if i in A_unique:
        pass
    else:
        ans += 1

print(ans)

Solution (Python):
N, K = map(int, input().split())
mem = set()
for _ in range(K):
  _ = input()
  mem = mem | set(map(int, input().split()))

mem_count = len(mem)
print(N-mem_count)

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

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

for i in range(k * 2):
  a = list(map(int, input().split()))
  if i % 2 != 0:
    for j in a:
      hoge[j - 1] = 0
      
print(sum(hoge))

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

for x in range(K):
    d = int(input())
    snukes = list(map(int,input().split()))
    for i in snukes:
        sozinho[i-1] += 1

print(sozinho.count(0))

Solution (Python):
n,k=map(int,input().split())
d=list()
array=list()
for i in range(k):
	d.extend(input())
	array.extend(input().split())

print(n-len(set(array)))

Solution (Python):
import itertools
N,K = map(int,input().split())
d = list()
A = list()
for _ in range(K):
    d.append(int(input()))
    A.append(list(map(int,input().split())))
A = list(itertools.chain.from_iterable(A))
A = set(A)
print(N-len(A))

Solution (Python):
import collections
li=[]
n,k=map(int,input().split())
for i in range(k):
    d=int(input())
    lik=list(map(int,input().split()))
    li+=lik
li=collections.Counter(li)
ans=0
for j in range(1,n+1):
    if li[j]==0:
        ans+=1
print(ans)

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

d = []
A = []
for k in range(K):
    d_temp = int(input())
    d.append(d_temp)
    a_temp = input().split()
    for a in range(d_temp):
        A.append(int(a_temp[a]))

count = 0
for n in range(N):
    judg = (n+1) in A
    if judg == False:
        count += 1
print(count)

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

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

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

Solution (Python):
class abc_166:
    
    def __init__(self):
        pass
    
    def A(self):
        S=input()
        ans= "ARC" if S=="ABC" else "ABC"
        print(ans)
    
    def B(self):
        NK=list(map(int,input().split()))
        d=[]
        A=[]
        
        for i in range(NK[1]):
            d=int(input())
            a = list(map(int,input().split()))
            A.extend(a)
        
        print(NK[0]-len(list(set(A))))  
            
    def C(self):
        pass
    
    def D(self):
        pass
    
    def E(self):
        pass
    
    def F(self):
        pass
    
    
if __name__=='__main__':
    obj=abc_166()
    obj.B()

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

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

Solution (Python):




def main():
    nk = input().split(" ")

    d = []
    a = []
    for i in range(int(nk[1])):
        d.append(int(input()))
        a.append(input().split(" "))
        a[i] = [int(s) for s in a[i]]

    l = [0] * (int(nk[0]) + 1)
    
    for i in range(int(nk[1])):
        for j in range(d[i]):
            z = a[i][j]
            l[z] += 1

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

    print(count - 1)
    return

if __name__ == '__main__':
    main()

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

Solution (Python):
N, K = map(int, input().split())
ls = []
for x in range(K*2):
    ls.append(input().split())
ls2 = []
i = 1
while i < K*2:
    for j in ls[i]:
        ls2.append(j)
    i += 2
ls2 = set(ls2)
print(N - len(ls2))

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

for i in range(K):
    d = int(input())
    a = list(map(int, input().split()))
    [s.add(num) for num in a]

print (N - len(s))

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

print(len(C))

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

havesweet = []
for num in range(N):
  havesweet.append(0)

for num in range(K):
  d.append(int(input()))
  a.append(list(map(int, input().split())))
  
  for having in a[num]:
    havesweet[having-1] += 1	

result = 0
for having in havesweet:
  if having == 0:
    result += 1

print(result)

Solution (Python):
N,K=(int(x) for x in input().split())
lists=[0]*N
while 1:
    try:
        tmp=int(input())
    except :
        break
    have_count=(int(x) for x in input().split())
    for i in have_count:
        lists[i-1]=1
print(lists.count(0))

Solution (Python):
a,b = map(int, input().split())
List = [list(map(int, input().split())) for i in range(2*b)]
list_all=[]
Output = 0
for i in range(b):
  list_all = list_all+List[2*i+1]
set_a = set(list_all)
Output = a- len(set_a)
print(Output)

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

Solution (Python):
N,K = map(int, input().split())
d = [0] * K
A = []
Nlist = []
B = 0

for _ in range(N):
    Nlist.append(0)


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

for j in range(K):
    for k in range(d[j]):
        Nlist[A[j][k]-1] += 1

for l in range(N):
    if Nlist[l] == 0:
        B = B + 1

print(B)

Solution (Python):
n, k = map(int, input().split())
s = set()
for _ in range(k):
    d = int(input())
    a = tuple(map(int, input().split()))
    for _a in a:
        s.add(_a)

print(n - len(s))

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


d_list = list()
sunuke_idx_set = set()

for i in range(K):
  d_list.append(int(input()))
  sunuke_idx_set |= set(map(int, input().split(' ')))
  



print(N - len(sunuke_idx_set))

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

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

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

Solution (Python):
import itertools
import numpy as np
N,K=map(int,input().split())
count=0
sunuke=[]
sweets=[]
for i in range(1,N+1):
    sunuke.append(i)
while(1):
    d=int(input())
    A=list(map(int,input().split()))
    sunuke=list(set(sunuke)-set(A))
    count+=1
    if count==K:
        break
print(len(sunuke))

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

have = set(a)

print(n - len(have))

Solution (Python):
n,k = map(int,input().split())
d=[0 for i in range(k+1)]
a=[[0 for i in range(101)] for i in range(k+1)]
for i in range(1,k+1):
    d[i]=int(input())
    l = list(input().split())
    for j in range(1,d[i]+1):
        a[i][j]=int(l[j-1])
lis=[i for i in range(1,n+1)]
for i in range(1,k+1):
    for j in range(1,d[i]+1):
        for m in lis:
            if a[i][j]==m:
                try:
                    lis.remove(m)
                except:
                    continue
print(len(lis))

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

l=[0]*N

for i in range(K):
  d = int(input())
  m = list(map(int,input().split()))
  for j in range(N):
    l[j] += m.count(j+1)

  
print(l.count(0))