Problem: 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

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 111111;
const int MAXB = 411;
int N, w;
long long ANS;
int POS;
int Bs, Bc;
struct Peo {
  int a, b;
} P[MAXN];
bool cmpb(Peo A, Peo B) { return A.b < B.b; }
struct Block {
  long long Num[MAXB];
  int Stack[MAXB], Head, Tail;
  long long TT[MAXB];
  int Time;
  int L, R;
  Block() {
    for (int i = 0; i < MAXB; ++i) Num[i] = 0LL;
    Time = 0;
  }
  void Calc() {
    Head = 1;
    Tail = 1;
    for (int i = L, j = 1; i <= R; ++i, ++j) {
      while (Tail > Head) {
        if (Num[Stack[Tail - 1]] <
            Num[j] + TT[Tail - 1] * (long long)(j - Stack[Tail - 1])) {
          --Tail;
        } else
          break;
      }
      if (Tail == Head) {
        Stack[Tail] = j;
        TT[Tail++] = 0LL;
      } else {
        Stack[Tail] = j;
        TT[Tail] =
            (Num[Stack[Tail - 1]] - Num[j]) / (long long)(j - Stack[Tail - 1]);
        if ((Num[Stack[Tail - 1]] - Num[j]) %
                (long long)(j - Stack[Tail - 1]) !=
            0LL)
          TT[Tail] += 1LL;
        ++Tail;
      }
    }
  }
  void Pdw() {
    if (Time == 0) return;
    for (int i = L, j = 1; i <= R; ++i, ++j) {
      Num[j] += (long long)(Time) * (long long)(i);
    }
    Time = 0;
  }
  long long Ask(int &p) {
    while (Head + 1 < Tail && TT[Head + 1] <= Time) ++Head;
    p = Stack[Head];
    return Num[p] + Time * (long long)(p + L - 1);
  }
} B[MAXB];
void Update(int k) {
  int Bat = k / Bs + 1;
  for (int i = 1; i < Bat; ++i) {
    ++B[i].Time;
  }
  B[Bat].Pdw();
  for (int i = B[Bat].L, j = 1; i <= k; ++i, ++j) {
    B[Bat].Num[j] += i;
  }
  B[Bat].Calc();
}
long long Query(int &p) {
  long long ret = 0LL, rr;
  int pp;
  for (int i = 1; i <= Bc; ++i) {
    rr = B[i].Ask(pp);
    pp = pp + B[i].L - 1;
    if (ret < rr) {
      ret = rr;
      p = pp;
    }
  }
  return ret;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> N >> w;
  Bs = 317;
  Bc = 316;
  for (int i = 1; i <= Bc; ++i) {
    B[i].L = (i - 1) * Bs;
    B[i].R = B[i].L + Bs - 1;
  }
  B[Bc].R = 100000;
  for (int i = 1; i <= Bc; ++i) B[i].Calc();
  for (int i = 1; i <= N; ++i) cin >> P[i].a >> P[i].b;
  sort(P + 1, P + N + 1, cmpb);
  for (int c = 0, j = 1; c <= P[N].b + 1; ++c) {
    while (j <= N && P[j].b < c) {
      Update(P[j].a);
      ++j;
    }
    ANS = (long long)(c) * (long long)(w) * (long long)(N - j + 1) + Query(POS);
    cout << ANS << " " << POS << endl;
  }
  return 0;
}