#!/usr/local/gnu/bin/bash
read n k
l=(`seq 0 $n`)
for i in `seq $k`
do
    read d
    read -a a
    for j in ${a[@]}
    do
        l[$j]="x"
    done
done
l=(`echo ${l[@]} | tr -d 0x`)
echo ${#l[@]}
