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;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) f = ch == '-' ? -1 : f, ch = getchar();
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return x * f;
}
int buf[30];
inline void write(long long x) {
  if (x < 0) putchar('-'), x = -x;
  for (; x; x /= 10) buf[++buf[0]] = x % 10;
  if (!buf[0]) buf[++buf[0]] = 0;
  for (; buf[0]; putchar('0' + buf[buf[0]--]))
    ;
}
const int N = 100005;
const int A = 100005;
const int T = 320;
int beg[T], des[T], head[T], tail[T], tag[T];
int bel[A];
long long f[A];
int n, w, mxa, mxb, t, cnt;
struct L {
  long long k, b;
  inline L(long long k_ = 0, long long b_ = 0) { k = k_, b = b_; }
  inline long long f(int x) { return k * x + b; }
} deq[T][T];
inline long double cross(L p, L q) {
  return (long double)(q.b - p.b) / (p.k - q.k);
}
struct people {
  int bear, pay;
  inline bool operator<(people const p) const { return bear < p.bear; }
} peo[N];
inline void rebuild(int bid) {
  for (int i = beg[bid]; i <= des[bid]; ++i) f[i] += 1ll * i * tag[bid];
  tag[bid] = 0, head[bid] = 1, tail[bid] = 0;
  for (int i = beg[bid]; i <= des[bid]; ++i) {
    L tmp = L(i, f[i]);
    for (; head[bid] < tail[bid] &&
           cross(tmp, deq[bid][tail[bid]]) <
               cross(deq[bid][tail[bid]], deq[bid][tail[bid] - 1]);
         --tail[bid])
      ;
    deq[bid][++tail[bid]] = tmp;
  }
}
void pre() {
  t = trunc(sqrt(mxa)) + 1;
  for (int st = 1, en; st <= mxa; st = en) {
    en = min(st + t, mxa + 1), beg[++cnt] = st, des[cnt] = en - 1;
    for (int i = st; i < en; ++i) bel[i] = cnt;
  }
  for (int i = 1; i <= cnt; ++i) rebuild(i);
}
inline void ADD(int x) {
  for (int i = 1; i <= cnt && beg[i] <= x; ++i)
    if (des[i] > x) {
      for (int j = beg[i]; j <= x; ++j) f[j] += j;
      rebuild(i);
    } else
      ++tag[i];
}
inline void query(int bid, int &x, long long &ret) {
  for (; head[bid] < tail[bid] &&
         cross(deq[bid][head[bid]], deq[bid][head[bid] + 1]) < tag[bid];
       ++head[bid])
    ;
  ret = deq[bid][head[bid]].f(tag[bid]), x = (int)deq[bid][head[bid]].k;
}
void calc() {
  for (int i = 0, ad = n, cur = 1, best; i <= mxb + 1; ++i) {
    for (; cur <= n && peo[cur].bear < i; --ad, ++cur) ADD(peo[cur].pay);
    long long profit = best = 0;
    for (int j = 1; j <= cnt; ++j) {
      long long y;
      int x;
      query(j, x, y);
      if (profit < y) profit = y, best = x;
    }
    write(profit + 1ll * ad * i * w), putchar(' '), write(best), putchar('\n');
  }
}
int main() {
  n = read(), w = read();
  for (int i = 1; i <= n; ++i)
    mxa = max(mxa, peo[i].pay = read()), mxb = max(mxb, peo[i].bear = read());
  sort(peo + 1, peo + 1 + n), pre(), calc();
  return 0;
}
