import Control.Applicative
import Control.Monad
import qualified Data.IntMap as IM
import Data.Array.IO
import Data.List
import Control.Monad.State

modifyArray arr i f = readArray arr i >>= \x -> writeArray arr i (f x)

infixr 1 ?
(?) :: Bool -> (a,a) -> a
(?) b t = (if b then fst else snd) t

main = do
  [n,m] <- map read . words <$> getLine :: IO [Int]
  arr <- newArray (1,n) IM.empty :: IO (IOArray Int (IM.IntMap Int))

  s <- head <$>
    (replicateM m $ do
        [a,b] <- map read . words <$> getLine :: IO [Int]
        modifyArray arr a $ IM.insertWith (+) b 1
        modifyArray arr b $ IM.insertWith (+) a 1
        return a
    )

  let
    solve :: StateT (Int,Int) IO Bool
    solve = do
      (a,k) <- get
      im <- lift $ readArray arr a

      if IM.null im then do
        return $ if k >= n then True else False
        
        else do
        let ((b,i), im_) = IM.deleteFindMin im

        --lift $ print $ (a,b)
        --lift $ print =<< getElems arr
        
        lift $ writeArray arr a $ if i == 1 then im_ else IM.insert b (i-1) im_
        lift $ modifyArray arr b $ \imap -> if i == 1 then IM.delete a imap else IM.insert a (i-1) imap

        put (b,k+1)
        solve

  
  putStrLn =<< (? ("YES", "NO")) <$> evalStateT solve (s,0)

  
