program main

    ! <module>s to import
    use, intrinsic :: iso_fortran_env

    ! require all variables to be explicitly declared
    implicit none

    ! variables for this <program>
    logical,        allocatable :: status_snack(:,:)
    integer(INT16)              :: num_people
    integer(INT16)              :: num_snack
    integer(INT16)              :: num_victims
    integer(INT16)              :: bffr_num_snack
    integer(INT16), allocatable :: bffr_id(:)

    ! support variables for this <program>
    integer(INT16) :: itr_id, itr_snack


    read(unit= INPUT_UNIT, fmt= *) num_people, num_snack

    allocate( status_snack(1:num_snack, 1:num_people) )
    allocate( bffr_id(1:num_people) )

    do itr_snack = 1_INT16, num_snack, 1_INT16

        read(unit= INPUT_UNIT, fmt= *) bffr_num_snack
        read(unit= INPUT_UNIT, fmt= *) bffr_id(1:bffr_num_snack)

        do itr_id = 1_INT16, bffr_num_snack, 1_INT16
            status_snack( itr_snack, bffr_id(itr_id) ) = .true.
        end do

    end do

    num_victims = num_people

    loop_id    : do itr_id    = 1_INT16, num_people, 1_INT16
    loop_snack : do itr_snack = 1_INT16, num_snack,  1_INT16
        if ( status_snack(itr_snack, itr_id) ) then
            num_victims = num_victims - 1_INT16
            exit loop_snack
        end if
    end do loop_snack
    end do loop_id

    deallocate( status_snack )
    deallocate( bffr_id )

    write(unit= OUTPUT_UNIT, fmt='(I0)') num_victims

end program main