while true
    n, k = gets.chomp.split.map(&:to_i)
    break if [n, k] == [0, 0]
    arr = []
    k.times{arr << gets.to_i}
    arr.sort!
    max = 1
    if arr.length == 1
        puts max
    else
        blank = arr[0] == 0
        arr.delete 0
        arr2, prev = [[arr[0], arr[0]]], arr[0]
        arr[1..-1].each{|x|
            if x == prev + 1
                arr2[-1][1] = x
            else
                arr2 << [x, x]
            end
            prev = x
        }
        if blank
            max = arr2[0][1] - arr2[0][0] + 2
            arr2.each_cons(2){|left, right|
                l = right[1] - right[0] + 2
                l += left[1] - left[0] + 1 if left[1] + 2 == right[0]
                max = l if max < l
            }
        else
            arr2.each{|a, b| max = b - a + 1 if max < b - a + 1}
        end
        puts max
    end
end

