#include<iostream>

using namespace std;

int main(){
  int L, Gain[12], Consume[12], i, saving, month;
  while(cin >> L, L){
    for(i=0; i<12; i++){
      cin >> Gain[i] >> Consume[i];
    }
    saving = 0;
    month = 0;
    for(i=0; i<12; i++){
      if(saving < L){
	month += 1;
      }
      saving += Gain[i] - Consume[i];
    }
    if(month<=12 && saving >= L){
      cout << month << endl;
    }else{
      cout << "NA" << endl;
    }
  }
}