A shuttle with cap seats serves n passenger trips along one route. Trip i boards riders passengers at position board who leave at position alight, occupying the shuttle over the half-open stretch [board, alight) (a passenger leaving at position x is not aboard at x, so at any shared position alightings are applied before boardings). Report the earliest integer position at which the number of passengers aboard strictly exceeds cap, or -1 if the capacity is never exceeded.
Input format
Line 1: two integers n and cap.
Next n lines: three integers board alight riders (with board < alight).
Output format
A single integer: the earliest position where the load exceeds cap, or -1.
Constraints
- 1 ≤ n ≤ 100000
- 0 ≤ cap ≤ 1000000
- 0 ≤ board < alight ≤ 1000000
- 1 ≤ riders ≤ 1000000