n, t = list(map(lambda x: int(x), input().split(" ")))
guests = [list(map(lambda x: int(x), input().split(" "))) for x in range(n)]

events = []
for guest in guests:
    events.append([guest[0], 1])
    events.append([guest[1], -1])

events.sort(key=lambda x: (x[0], x[1]))

max = 0
count = 0
for event in events:
    count += event[1]
    if count>max: max = count

print(max)
