#include<iostream>
using namespace std;

int main()
{
    int l, m, n;

    while( cin >> l )
    {
        if( l == 0 )
            break;
        
        int sum = 0, cnt = 0;
        for( int i = 0; i < 12; i++ )
        {
            cin >> m >> n;
            
            if( l <= sum );
            else
            {
                sum += ( m - n );
                cnt++;
            }
        }
        if( cnt == 12 && sum < l )
            cout << "NA" << endl;
        else
            cout << cnt << endl;
    }

    return 0;
}
