eval"N,M="+gets.split*?, x=gets.to_i a=(1...N).map{gets.to_i}.sort p a.bsearch{|y|b=a.dup;b.delete_at b.index y;i=0;(N-3).downto(0).count{|j|i+=1while i=b[i]+b[j];i