### main

loop do
  n, k = gets.strip.split(' ').map{|s| s.to_i}
  break if (n | k) == 0

  as = []
  white = false

  k.times do
    ci = gets.strip.to_i - 1

    if ci < 0
      white = true
    else
      c0 = c1 = ci
      if ci > 0 && ! as[ci - 1].nil?
        c0 = as[ci - 1][0]
      end
      if ci < n - 1 && ! as[ci + 1].nil?
        c1 = as[ci + 1][1]
      end

      as[c0] = as[c1] = [c0, c1]
    end
  end
  #p as

  rs = []
  ci = 0

  while ci < n
    if ! as[ci].nil?
      rs << as[ci]
      ci = as[ci][1]
    end
    ci += 1
  end
  #p rs
  #p white

  prvr = nil
  max_seq = 0

  for r in rs
    c0, c1 = r
    seq = c1 - c0 + 1

    if white
      if c0 > 0 || c1 < n - 1
        seq += 1
        if ! prvr.nil? && prvr[1] == c0 - 2
          seq += prvr[1] - prvr[0] + 1
        end
      end
    end

    max_seq = seq if max_seq < seq

    prvr = r
  end

  puts max_seq
end