G. Gallivanting Merchant
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output
Examples
Input
3 5
2 6
6 11
16 21
Output
3
Input
8 4
2 4
9 10
1 2
4 5
5 7
2 10
11 11
11 13
Output
6
Input
4 100
100 101
101 102
102 103
103 104
Output
2