Codeforces Round 169 (Div. 2)
A
Lunch Rush
Codeforces
900
原题
←B →
翻译中…

Having written another programming contest, three Rabbits decided to grab some lunch. The coach gave the team exactly $*k*$ time units for the lunch break.

翻译中…

The Rabbits have a list of $*n*$ restaurants to lunch in: the $*i*$-th restaurant is characterized by two integers $*f*_{*i*}$ and $*t*_{*i*}$. Value $*t*_{*i*}$ shows the time the Rabbits need to lunch in the $*i*$-th restaurant. If time $*t*_{*i*}$ exceeds the time $*k*$ that the coach has given for the lunch break, then the Rabbits' joy from lunching in this restaurant will equal $*f*_{*i*} - (*t*_{*i*} - *k*)$. Otherwise, the Rabbits get exactly $*f*_{*i*}$ units of joy.

翻译中…

Your task is to find the value of the maximum joy the Rabbits can get from the lunch, depending on the restaurant. The Rabbits must choose exactly one restaurant to lunch in. Note that the joy value isn't necessarily a positive value.

翻译中…

Input

翻译中…

The first line contains two space-separated integers — $*n*$ ($1 ≤ *n* ≤ 10^{4}$) and $*k*$ ($1 ≤ *k* ≤ 10^{9}$) — the number of restaurants in the Rabbits' list and the time the coach has given them to lunch, correspondingly. Each of the next $*n*$ lines contains two space-separated integers — $*f*_{*i*}$ ($1 ≤ *f*_{*i*} ≤ 10^{9}$) and $*t*_{*i*}$ ($1 ≤ *t*_{*i*} ≤ 10^{9}$) — the characteristics of the $*i*$-th restaurant.

翻译中…

Output

翻译中…

In a single line print a single integer — the maximum joy value that the Rabbits will get from the lunch.

翻译中…

样例

Input #1
2 5
3 3
4 5
Output #1
4
InputCopy OutputCopy
Input #2
4 6
5 8
3 6
2 3
2 2
Output #2
3
InputCopy OutputCopy
Input #3
1 5
1 7
Output #3
-1
InputCopy OutputCopy
题目信息
题号
276A
时间限制
2 s
内存限制
256 MB
标签
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。