#include <iostream>
using namespace std;

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