fun main(){
    val (n, k) = readLine()!!.split(" ").map { it.toInt() }
    val sunukeList = List(n){ 0 }.toMutableList()
    for (i in 0 until k){
        val d = readLine()!!.split(" ").map { it.toInt() }[0]
        val A = readLine()!!.split(" ").map { it.toInt() }
        for (j in 0 until d){
            sunukeList[A[j]-1]++
        }
    }
    sunukeList.sort()
    var count = 0
    for (i in 0 until n){
        if (sunukeList[i] == 0) count++
        else break
    }
    println(count)
}
