#include<iostream>
using namespace std;

int main(int argc, char *argv[]){
  int n, m, l;
  while(cin >> l, l){
    int sum = 0, month = 13;
    for (int i = 0; i < 12; i++) {
      cin >> n >> m;
      sum += n - m;
      if(sum >= l && month > i){
        month = i + 1;
      }
    }
    if(month <= 12){
      std::cout << month << std::endl;
    }else{
      std::cout << "NA" << std::endl;
    }
  }
  return 0;
}