object Main extends App {
  import scala.math.BigDecimal.RoundingMode
  import java.util.Scanner
  val sc = new Scanner(System.in)

  val n = sc.nextInt()
  val k = sc.nextInt()
  val result = (1 to k)
    .map { i =>
      val d = sc.nextInt()
      val a = (1 to d).map { _ =>
        sc.nextInt()
      }
      (1 to n).map(a.contains)
    }
    .transpose
    .map(_.contains(true))
    .count(!_)
  println(result)
}
