loop do
    n = gets.to_i
    break if n == 0

    k = nil 
    sum = 0 
    (1..12).each do |i| 
        sum += gets.split.map(&:to_i).inject(:-)
        k = i if !k && sum >= n
    end 

    puts k ? k : 'NA'
end