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

void main()
{
  auto rd = readln.split.to!(int[]), n = rd[0], c = rd[1];

  auto m = 10^^5*2+1;
  auto s = new int[](m);
  foreach (i; 0..n) {
    auto rd2 = readln.splitter;
    auto si = rd2.front.to!int; rd2.popFront();
    auto ti = rd2.front.to!int;
    s[si*2-1]++;
    s[ti*2]--;
  }

  foreach (i; 1..m) s[i] += s[i-1];

  writeln(s.reduce!max);
}
