import Control.Monad
import Data.List
data Count = In Int | Out Int deriving (Show)

countNum (In n) = n
countNum (Out n) = n

instance Eq Count where
    a == b = countNum a == countNum b
instance Ord Count where
    compare (In a) (Out b) = case compare a b of
                               EQ -> GT
                               _  -> compare a b
    compare (Out a) (In b) = case compare a b of
                               EQ -> LT
                               _  -> compare a b
    compare  a b = compare (countNum a) (countNum b)

main = do
    [n,t] <- map read.words<$>getLine
    customers <- replicateM n ((\[l,t] -> [In l, Out t]).map read.words<$>getLine)
    print $ maximum.cumSum.sort.concat$customers

cumSum :: [Count] -> [Int]
cumSum = scanl (\acc c -> case c of
                             (In _) -> acc+1
                             (Out _) -> acc-1) 0

