#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>

using namespace std;

#define reep(i,f,t) for(int i=f ; i<int(t) ; ++i)
#define rep(i,n) reep(i, 0, n) 

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int main()
{
	int L;
	while(scanf("%d", &L), L){
		int M, N;
		int money = 0;
		int ans = -1;
		rep(i, 12){
			scanf("%d%d", &M, &N);
			money += M - N;
			if(ans == -1 && money >= L){
				ans = i + 1;
			}
		}
		if(ans == -1)
			puts("NA");
		else
			printf("%d\n", ans);
	}

	return 0;
}