def c(a,b)w=l=0
while h=b.pop
(x=a.index{|x|x<=h})?(l+=x<h ?1:0;a.delete_at(x)):w+=1
end
w>l
end
until(n=gets.to_i)==0
a,b=2.times.map{gets.split.map(&:to_i).sort.reverse}
r=(1..n).find{|i|c(a[0,i],b[0,i])}
puts r ?r:"NA"
end