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;
namespace io {
const long long SIZE = (1 << 21) + 1;
char ibuf[SIZE], *iS, *iT;
char gc() {
  if (iS == iT) iT = (iS = ibuf) + fread(ibuf, 1, SIZE, stdin);
  if (iS == iT) return EOF;
  return *iS++;
}
inline long long gi() {
  char c;
  long long x = 0, f = 1;
  for (; c < '0' || c > '9'; c = gc())
    if (c == '-') f = -1;
  for (; c >= '0' && c <= '9'; c = gc()) x = (x << 1) + (x << 3) + c - '0';
  return x * f;
}
}  // namespace io
using io::gi;
const long long N = 100005, qN = 320;
long long n, w, amx, bmx = 1, bel[N], b, s[qN][qN], tp[qN], pos[qN], ind = 1,
                     br[N];
long long a[N], add[qN];
pair<long long, long long> p[N];
void build(long long x) {
  for (long long i = br[x - 1] + 1; i <= br[x]; i++) a[i] += add[x] * i;
  add[x] = pos[x] = tp[x] = 0;
  for (long long i = br[x - 1] + 1; i <= br[x]; i++) {
    while (tp[x] > 1 &&
           (a[i] - a[s[x][tp[x]]]) * (s[x][tp[x]] - s[x][tp[x] - 1]) >=
               (a[s[x][tp[x]]] - a[s[x][tp[x] - 1]]) * (i - s[x][tp[x]]))
      --tp[x];
    s[x][++tp[x]] = i;
  }
  for (pos[x] = 1; pos[x] < tp[x] && a[s[x][pos[x] + 1]] >= a[s[x][pos[x]]];
       pos[x]++)
    ;
}
void update(long long x) {
  for (; pos[x] < tp[x] && a[s[x][pos[x] + 1]] + add[x] * s[x][pos[x] + 1] >=
                               a[s[x][pos[x]]] + add[x] * s[x][pos[x]];
       pos[x]++)
    ;
}
void upd(long long r) {
  long long y;
  for (y = 1; y * b + 1 <= r; y++) ++add[y], update(y);
  for (long long l = (y - 1) * b + 1; l <= r; l++) a[l] += l;
  build(bel[r]);
}
int main() {
  n = gi(), w = gi();
  for (long long i = 1; i <= n; i++) {
    p[i].second = gi(), p[i].first = gi();
    amx = max(amx, p[i].second);
    bmx = max(bmx, p[i].first);
  }
  b = sqrt(amx);
  for (long long i = 1; i <= amx; i++)
    bel[i] = (i - 1) / b + 1, br[i] = min(i * b, amx);
  sort(p + 1, p + 1 + n);
  for (long long i = 1; i <= bel[amx]; i++) build(i);
  for (long long c = 0; c <= bmx + 1; c++) {
    for (; ind <= n && c > p[ind].first; ++ind) upd(p[ind].second);
    long long ans = 0, ans2 = 0;
    for (long long i = 1; i <= bel[amx]; i++) {
      if (a[s[i][pos[i]]] + add[i] * s[i][pos[i]] > ans)
        ans = a[s[i][pos[i]]] + add[i] * s[i][pos[i]], ans2 = s[i][pos[i]];
    }
    printf("%lld %lld\n", ans + (long long)w * c * (n - ind + 1), ans2);
  }
}