#include<iostream>

using namespace std;
int main(void){

	int L,M,N,wa=0,mo=-1;

	cin>>L;
	for(int i=1;i<=12;i++){
		cin>>M>>N;
		wa+=M-N;
		if(wa>=L&&mo==-1) mo=i;
	}
	if(mo!=-1) cout<<mo<<endl;
	else cout<<"NA"<<endl;
	return 0;
}