object Main extends App{
  val Array(n,m) = scala.io.StdIn.readLine.split(" ").map(_.toInt)
  val h = scala.io.StdIn.readLine.split(" ").map(_.toInt)
  val ab = for(count <- 1 to m) yield scala.io.StdIn.readLine.split(" ").toList.map(_.toInt)
  val alone_deck = ((1 to n).toSet &~ ab.reduce(_ ::: _).toSet).toList
  val not_good = (for(count <- ab) yield {
    if(count(0) < count(1)) count(1)
    else if(count(1) < count(0)) count(0)
  }).toList
  val good = ((1 to n).toSet &~ not_good.toSet).toList
  println((alone_deck ::: good).distinct.size)
}
