import qualified Data.ByteString.Char8 as BS
import Data.Maybe
import Control.Monad
import Data.List
import           Data.Bits

input :: IO [Int]
input = do
    d <- (fst . fromJust) . BS.readInt <$> BS.getLine
    map (fst.fromJust.BS.readInt).BS.words <$> BS.getLine

process :: [Int] -> Integer
process [] = 0 :: Integer
process (x:xs) =  (shift 1 x) .|. process xs   

main :: IO ()
main = do
    [n,k] <- map (fst.fromJust.BS.readInt).BS.words <$> BS.getLine
    ass <- replicateM k input
    putStr $ show $ result n ass 
    where
        hammingWeight ass = popCount $ convoluton (map process ass) 
        result n ass = n - hammingWeight ass
        convoluton = foldl (.|.) (0::Integer)
