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 long long NR = 1e5 + 10;
const long long MR = 505;
void Max(long long &x, long long y) { x = max(x, y); }
void Min(long long &x, long long y) { x = min(x, y); }
long long n, m, w, mx, all, kc;
struct Fk {
  long long l, r, k;
} p[MR];
struct Nd {
  long long a, b;
  bool operator<(const Nd &A) const { return b < A.b; }
} t[NR];
long long cal(long long x, long long pos) { return x * (n - pos + 1); }
long long d[NR];
long long cnt[NR];
long long q[MR][MR];
long long L[MR], R[MR];
double slope(long long id1, long long id2) {
  return 1. * (d[id1] - d[id2]) * 1. / (id2 - id1);
}
void doit(long long id, long long x) {
  while (L[id] < R[id] && slope(q[id][L[id]], q[id][L[id] + 1]) <= x) L[id]++;
}
void rebuild(long long id) {
  L[id] = 1, R[id] = 0;
  for (long long i = p[id].l; i <= p[id].r; i++) {
    while (L[id] < R[id] &&
           slope(q[id][R[id]], i) < slope(q[id][R[id] - 1], q[id][R[id]]))
      R[id]--;
    q[id][++R[id]] = i;
  }
  doit(id, 0);
}
long long Num(long long x) { return (x - 1) / kc + 1; }
void add(long long x) {
  if (x <= 0) return;
  long long len = Num(x);
  for (long long i = 1; i < len; i++) doit(i, ++cnt[i]);
  for (long long i = p[len].l; i <= p[len].r; i++) d[i] += cnt[len] * i;
  for (long long i = p[len].l; i <= x; i++) d[i] += i;
  cnt[len] = 0;
  rebuild(len);
}
long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 3) + (x << 1) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
signed main() {
  n = read(), w = read();
  for (long long i = 1; i <= n; i++)
    t[i].a = read(), t[i].b = read(), Max(mx, t[i].b), Max(all, t[i].a);
  sort(t + 1, t + n + 1);
  kc = sqrt(all);
  long long now = 1;
  for (long long i = 1; i <= all; i += kc)
    p[++m].l = i, p[m].r = min(all, i + kc - 1), p[m].k = 0;
  for (long long c = 0; c <= mx + 1; c++) {
    while (t[now].b < c && now <= n) add(t[now].a), now++;
    long long ans = -1, pos = 0;
    for (long long i = 1; i <= m; i++) {
      long long x = q[i][L[i]];
      if (d[x] + x * cnt[i] >= ans) ans = d[x] + x * cnt[i], pos = x;
    }
    printf("%lld %lld\n", ans + w * c * (n - now + 1), pos);
  }
  return 0;
}
