#include<iostream>
#include<algorithm>
#define MONTH 12
using namespace std;
int main() {
	long l;
	while (cin >> l){
		int n = 13;
		long sum = 0;
		for (int i = 0; i < MONTH; i++){
			long long a, b; cin >> a >> b;
			sum += a - b;
			if (sum >= l){
				n = min(n, i + 1);
			}
		}
		if (n == 13){
			cout << "NA";
		}
		else cout << n;
		cout << endl;
	}
}