import std.stdio, std.string, std.conv, std.range, std.algorithm, std.functional, std.typecons;

void main() {
    auto tmp = readln.split.to!(float[]);
    auto N = tmp[0], C = tmp[1];
    alias Point = Tuple!(float, bool);
    Point[] points;
    foreach (i; 0..N) {
        tmp = readln.split.to!(float[]);
        auto s = tmp[0], t = tmp[1];
        points ~= tuple(s-0.5f, true);
        points ~= tuple(t, false);
    }
    points.sort!((a,b) => a[0] < b[0]);
    auto cnt = 0;
    auto maxCnt = 0;
    foreach (p; points) {
        if (p[1]) {
            cnt++;
            if (cnt > maxCnt) maxCnt = cnt;
        } else {
            cnt--;
        }
    }
    writeln(maxCnt);
}
