program main
integer :: n,k,sum
integer :: A(100,100),d(100)

read(*,*) n,k
do i = 1,k
read(*,*) d(i)
read(*,*) (A(i,j),j=1,d(i))
end do

do i = 1,n
do j = 1,d(i)
if (i == A(i,j)) exit
end if
sum = sum +1
end do 
end do

write(*,*)sum
end program