Paprika ID Cards

No attempts yetTime limit1sMemory limit256 MB

Problem

Marin is an assistant chef at Plavi 9, a busy restaurant whose menu today includes stuffed paprikas. Every assistant chef knows that a paprika has to be young when it is stuffed, so Marin stuffs only the paprikas that are no older than XX days. He serves the rest fresh, as an appetizer. A new law says that every paprika has to carry its ID card at all times, so Marin judges the age of a paprika from the number on the card it holds.

It is less known that paprikas have their own goals in life besides their official papers. From an early age a paprika knows whether it wants to be served fresh or stuffed once it grows up. The NN paprikas now standing in line to be stuffed have a problem. Some of them want to be part of the dish but are too old, and some want to be served fresh but are about to be stuffed.

The paprikas do not know the number XX that Marin picked, so they decided to correct the injustice this way. The first paprika tries to swap its ID card with the second one, then the second tries to swap with the third, and so on to the end of the line. Two paprikas swap their cards when the one currently holding the larger number wants to be stuffed and the one holding the smaller number does not. They do not swap if the two numbers are equal.

After all the swaps, Marin reads the number on the card each paprika holds. A paprika is stuffed when that number is at most XX, and served fresh when the number is larger than XX. Determine how many paprikas reach their goal in life.

Input

The first line contains the integers NN and XX. (1N,X10001 \le N, X \le 1000)

Each of the next NN lines contains the integers aa and bb describing one paprika, in the order the paprikas stand in line. (1a10001 \le a \le 1000, 0b10 \le b \le 1)

The number aa is printed on the ID card of that paprika and is its age in days. The number bb is its goal in life, 00 if it wants to be served fresh and 11 if it wants to be stuffed.

Output

Print, on a single line, the number of paprikas that reach their goal in life.

Hint

In the first example every paprika is young enough, but not a single one of them wants to be stuffed.

In the second example every pair of adjacent paprikas swaps ID cards.