program main
  implicit none
  integer :: n, i, c, s, t, dummy
  integer, allocatable :: cnt(:)
  read *, n, c
  allocate (cnt(0:200000))
  cnt(:) = 0
  do i = 1, n
    read *, s, t, dummy
    cnt(2 * s - 1) = cnt(2 * s - 1) + 1
    cnt(2 * t) = cnt(2 * t) - 1
  end do

  do i = 1, 200000
    cnt(i) = cnt(i) + cnt(i - 1)
  end do
  print "(i0)", maxval(cnt)
end program main
