import Control.Monad (replicateM)
import Data.Array (Array,(!))
import qualified Data.Array.IO as IOArr

main = do
    [n,k] <- getLine >>= return . map read . words
    if all (==0) [n,k] then return () else do
        flags <- IOArr.newArray (0,n) False
            :: IO (IOArr.IOArray Int Bool)
        replicateM k (getLine >>= return . read >>=
            (\n -> IOArr.writeArray flags n True))
        flags <- IOArr.freeze flags
        print $ solve n flags 
        main 

solve :: Int -> Array Int Bool -> Int
solve n flags 
    | flags ! 0 == False    = maximum $ map fst $ sublist
    | flags ! 0 == True     = maximum $ map snd $ sublist
    where
    sublist :: [(Int,Int)]
    sublist = scanl update (0,0) [flags!i|i<-[1..n]]

    update :: (Int,Int) -> Bool -> (Int,Int)
    update (a,b) False = (0,a+1)
    update (a,b) True  = (a+1,b+1)