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;
inline int read() {
  int x = 0;
  char c = getchar();
  bool f = 0;
  for (; c > '9' || c < '0'; f = c == '-', c = getchar())
    ;
  for (; c >= '0' && c <= '9'; x = (x << 1) + (x << 3) + c - '0', c = getchar())
    ;
  return f ? -x : x;
}
inline void write(int x) {
  if (x < 0) putchar('-'), x = -x;
  if (x >= 10) write(x / 10);
  putchar(x % 10 + 48);
}
const int B = 320;
int m, w;
int l[B], r[B], tag[B], p[B], lim[B];
long long mx[B], ans[B][B];
void rebuild(int x) {
  for (int i = 0, _y = r[x] - l[x]; i <= _y; ++i)
    ans[x][i] += (long long)(i + l[x]) * tag[x];
  tag[x] = p[x] = mx[x] = 0;
  for (int i = 0, _y = r[x] - l[x]; i <= _y; ++i)
    if (ans[x][i] > mx[x]) mx[x] = ans[x][i], p[x] = i + l[x];
  lim[x] = 2e9;
  for (int i = p[x] - l[x] + 1, _y = r[x] - l[x]; i <= _y; ++i)
    lim[x] =
        min((long long)lim[x], (mx[x] - ans[x][i]) / (i + l[x] - p[x]) + 1);
}
void insert(int a) {
  --m;
  int x = a / B, y = a % B;
  for (int i = 0, _y = x - 1; i <= _y; ++i) {
    ++tag[i];
    if (!--lim[i])
      rebuild(i);
    else
      mx[i] += p[i];
  }
  for (int i = 0, _y = y; i <= _y; ++i) ans[x][i] += i + l[x];
  rebuild(x);
}
void getans(int c) {
  long long ans = 0;
  int p = 0;
  for (int i = 0, _y = B - 1; i <= _y; ++i)
    if (mx[i] > ans) ans = mx[i], p = ::p[i];
  printf("%lld %d\n", ans + (long long)m * c * w, p);
}
void prepare(int A) {
  for (int i = 0, a = 0; a <= A; ++i, a += B) {
    l[i] = a;
    r[i] = min(A, a + B - 1);
    lim[i] = 1;
    mx[i] = 0;
    p[i] = a;
  }
}
int n, A, C;
pair<int, int> a[100005];
int main() {
  n = m = read(), w = read();
  for (int i = 1, _y = n; i <= _y; ++i) {
    int a = read(), b = read();
    ::a[i] = make_pair(b, a);
    C = max(C, b);
    A = max(A, a);
  }
  sort(a + 1, a + n + 1);
  prepare(A);
  int i = 1;
  for (int c = 0, _y = C + 1; c <= _y; ++c) {
    for (; i <= n && a[i].first < c; ++i) insert(a[i].second);
    getans(c);
  }
}