loop {
	n, k = gets.split.map &:to_i
	break if n == 0
	a = (1..k).map { gets.to_i }.sort
	wild_card = false
	if a[0] == 0
		wild_card = true
		a.shift
	end
	chunks = [[a[0], 1]]
	a[1..-1].each{|x|
		if x == chunks[-1][0] + chunks[-1][1]
			chunks[-1][1] += 1
		else
			chunks << [x, 1]
		end
	}
	if wild_card
		max = chunks.map(&:last).max + 1
		chunks.each_cons(2){|c1, c2|
			if c1[0] + c1[1] + 1 == c2[0]
				m = c1[1] + c2[1] + 1
				max = m if m > max
			end
		}
		p max
	else
		p chunks.map(&:last).max
	end
}