import scala.math.{min,max}

object Main {
  val sc = new java.util.Scanner(System.in)
  def main(args: Array[String]) {
    while(true) {
      val l = sc.nextInt
      if(l == 0) return

      val x = (1 to 12).map(_ => (sc.nextInt - sc.nextInt))
      val y = (1 to 12).map(n => x.take(n).sum).filter(_ < l)
      println( if(y.size == 12) "NA" else y.size + 1 )
    }
  }
}