All modern mobile applications are divided into free and paid. Even a single application developers often release two versions: a paid version without ads and a free version with ads.

<image>

Suppose that a paid version of the app costs p (p is an integer) rubles, and the free version of the application contains c ad banners. Each user can be described by two integers: ai — the number of rubles this user is willing to pay for the paid version of the application, and bi — the number of banners he is willing to tolerate in the free version.

The behavior of each member shall be considered strictly deterministic:

  * if for user i, value bi is at least c, then he uses the free version, 
  * otherwise, if value ai is at least p, then he buys the paid version without advertising, 
  * otherwise the user simply does not use the application. 



Each user of the free version brings the profit of c × w rubles. Each user of the paid version brings the profit of p rubles.

Your task is to help the application developers to select the optimal parameters p and c. Namely, knowing all the characteristics of users, for each value of c from 0 to (max bi) + 1 you need to determine the maximum profit from the application and the corresponding parameter p.

Input

The first line contains two integers n and w (1 ≤ n ≤ 105; 1 ≤ w ≤ 105) — the number of users and the profit from a single banner. Each of the next n lines contains two integers ai and bi (0 ≤ ai, bi ≤ 105) — the characteristics of the i-th user.

Output

Print (max bi) + 2 lines, in the i-th line print two integers: pay — the maximum gained profit at c = i - 1, p (0 ≤ p ≤ 109) — the corresponding optimal app cost. If there are multiple optimal solutions, print any of them.

Examples

Input

2 1
2 0
0 2


Output

0 3
3 2
4 2
2 2


Input

3 1
3 1
2 2
1 3


Output

0 4
3 4
7 3
7 2
4 2
#include <bits/stdc++.h>
using namespace std;
const int blk = 330, iblk = 330;
int n, w;
class peo {
 public:
  int a, b;
} p[100010];
vector<int> v[100010];
int val[100010], bel[100010], tag[100010];
long long timer[100010];
pair<long long, int> mx[iblk];
int L[iblk], R[iblk];
void rebuild(int id) {
  mx[id] = make_pair(0ll, 0);
  for (int i = L[id]; i <= R[id]; i++)
    mx[id] = max(mx[id], make_pair((long long)(tag[id] + val[i]) * i, i));
  int p = mx[id].second;
  timer[id] = 0x3f3f3f3f3f3f3f3f;
  for (int i = p + 1; i <= R[id]; i++)
    timer[id] = min(timer[id],
                    ((long long)p * val[p] - (long long)i * val[i]) / (i - p));
}
void modify(int p) {
  int id = bel[p];
  for (int i = 1; i < id; i++) {
    tag[i]++;
    mx[i].first += mx[i].second;
    while (tag[i] > timer[i]) rebuild(i);
  }
  for (int i = L[id]; i <= p; i++) val[i]++;
  rebuild(id);
}
int main() {
  scanf("%d%d", &n, &w);
  int mxb = 0;
  for (int i = 0; i <= 100001; i++) {
    bel[i] = i / blk + 1;
    if (!i || bel[i] != bel[i - 1]) L[bel[i]] = i;
    R[bel[i]] = i;
  }
  for (int i = 1; i <= bel[100001]; i++) mx[i] = make_pair(0, L[i]);
  for (int i = 1; i <= n; i++)
    scanf("%d%d", &p[i].a, &p[i].b), mxb = max(mxb, p[i].b),
                                     v[p[i].b].push_back(i);
  int cnt = n;
  for (int c = 0; c <= mxb + 1; c++) {
    pair<long long, int> cur = make_pair(0, 0);
    for (int i = 1; i <= bel[100001]; i++) cur = max(cur, mx[i]);
    printf("%lld %d\n", 1ll * cnt * c * w + cur.first, cur.second);
    cnt -= v[c].size();
    for (int &x : v[c]) modify(p[x].a);
  }
  return 0;
}
