import           Control.Monad (replicateM)
import           Data.IntMap   (IntMap)
import qualified Data.IntMap   as M (empty, insert, lookup)
import           Data.Monoid   (Sum (Sum, getSum))

main :: IO ()
main = do
  [_n, m] <- map read . words <$> getLine
  pss <- replicateM m $ do
    [p, s] <- words <$> getLine
    pure (read p, read s)
  let (accepted, wrongs) = solve pss
  putStrLn $ unwords $ map show [accepted, wrongs]

data Result = AC | WA
  deriving (Read, Eq)

type Problem = Int

solve :: [(Problem, Result)] -> (Int, Int)
solve pss =
  let
    f :: (Problem, Result) -> IntMap (Bool, Int) -> IntMap (Bool, Int)
    f (p, r) acc =
      case (M.lookup p acc, r) of
        (Nothing, WA)          -> acc
        (Nothing, AC)          -> M.insert p (True, 0) acc
        (Just (False, wa), WA) -> acc
        (Just (False, wa), AC) -> M.insert p (True, 0) acc
        (Just (True, wa), WA)  -> M.insert p (True, succ wa) acc
        (Just (True, wa), AC)  -> M.insert p (True, 0) acc

    aggregated = foldr f M.empty pss
  in
    (\(sn, sm) -> (getSum sn, getSum sm)) $ foldMap (\(b, m) -> (Sum (if b then 1 else 0), Sum m)) aggregated
