object Main extends App {
	val Array(n, m) = scala.io.StdIn.readLine.split(" ").map(_.toInt)

	val tp1 = Array.fill(n)(1)
	val tp2 = Array.fill(n)(0)

	tp2(0) = 1

	for(i<-0 until m){
		val Array(a, b) = scala.io.StdIn.readLine.split(" ").map(_.toInt - 1)

		if(tp1(a) != 0){
			tp1(a) -= 1
			tp1(b) += 1

			if(tp2(a) != 0){
				if(tp1(a) != 0){
					tp2(b) = 1
				}else{
					tp2(a) = 0
					tp2(b) = 1
				}
			}

		}
	}

	println(tp2.sum)
	
}