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 inf = 100000;
int b[120000], e[520], v[520];
long long h[120000];
bool c[120000];
int i, j, k, l, m, n, q, r, t;
long long s;
inline double cross(int x, int y) { return -1.0 * (h[x] - h[y]) / (x - y); }
struct CH {
  int q[520];
  int t;
  inline void rebuild(int l, int r) {
    t = 0;
    for (int i = l; i <= r; i++)
      if (c[i]) {
        for (; (t > 1) && (cross(i, q[t - 1]) < cross(q[t], q[t - 1])); t--)
          ;
        t++, q[t] = i;
      }
    return;
  }
  inline void ask(int k) {
    if (!t) return;
    int ll = 1, rr = t, mid;
    while (ll < rr) {
      mid = (ll + rr) / 2;
      if (cross(q[mid], q[mid + 1]) >= k)
        rr = mid;
      else
        ll = mid + 1;
    }
    if ((1LL * k * q[ll] + h[q[ll]] > s) ||
        ((1LL * k * q[ll] + h[q[ll]] == s) && (q[ll] < r)))
      s = 1LL * k * q[ll] + h[q[ll]], r = q[ll];
    return;
  }
};
CH B[520];
struct point {
  int x, y;
  inline bool operator<(const point t) const { return y < t.y; }
};
point p[120000];
inline void pushdown(int x) {
  if (e[x]) {
    for (int i = x * q - q; i < x * q - q + v[x]; i++)
      h[i] = h[i] + 1LL * i * e[x];
    e[x] = 0;
  }
  return;
}
inline void add(int x) {
  for (int i = 1; i * q - 1 < x; i++) e[i]++;
  pushdown(b[x]);
  for (int i = b[x] * q - q; i <= x; i++) h[i] = h[i] + i;
  c[x] = true;
  B[b[x]].rebuild(b[x] * q - q, b[x] * q - q + v[b[x]] - 1);
  return;
}
inline void ask() {
  s = 0, r = 0;
  for (int i = 1; i <= inf / q + 1; i++) B[i].ask(e[i]);
  return;
}
int main() {
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++) scanf("%d%d", &p[i].x, &p[i].y), t = max(t, p[i].y);
  sort(p + 1, p + n + 1);
  q = 500;
  for (i = 0; i <= inf; i++) b[i] = i / q + 1, v[b[i]]++;
  for (i = 0, k = 1; i <= t + 1; i++) {
    for (j = k; (j <= n) && (p[j].y == i - 1); j++) add(p[j].x);
    k = j;
    ask();
    printf("%I64d %d\n", 1LL * i * m * (n - k + 1) + s, r);
  }
  return 0;
}
