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;
template <typename T1, typename T2>
inline T1 max(T1 a, T2 b) {
  return a < b ? b : a;
}
template <typename T1, typename T2>
inline T1 min(T1 a, T2 b) {
  return a < b ? a : b;
}
const char lf = '\n';
namespace ae86 {
const int bufl = 1 << 15;
char buf[bufl], *s = buf, *t = buf;
inline int fetch() {
  if (s == t) {
    t = (s = buf) + fread(buf, 1, bufl, stdin);
    if (s == t) return EOF;
  }
  return *s++;
}
inline int ty() {
  int a = 0;
  int b = 1, c = fetch();
  while (!isdigit(c)) b ^= c == '-', c = fetch();
  while (isdigit(c)) a = a * 10 + c - 48, c = fetch();
  return b ? a : -a;
}
}  // namespace ae86
using ae86::ty;
const int N = 100000, _ = N + 7, B = 320;
int n, mxb = 0, bel[_] = {0}, bl[_] = {0}, br[_] = {0}, bcnt = 0;
long long per, sum[_] = {0};
vector<int> hav[_];
int cmp(int a, int b, int c) {
  return (sum[b] - sum[a]) * (c - a) <= (sum[c] - sum[a]) * (b - a);
}
long long f(int x, long long d) { return d * x + sum[x]; }
int loc[_], now[_], q[_] = {0};
long long tag[_] = {0};
void make(int x) {
  loc[x] = bl[x] - 1, now[x] = bl[x];
  for (int i = bl[x]; i <= br[x]; i++) {
    while (loc[x] > bl[x] && cmp(q[loc[x] - 1], q[loc[x]], i)) loc[x]--;
    q[++loc[x]] = i;
  }
}
void up(int x) {
  while (now[x] < loc[x] && f(q[now[x]], tag[x]) < f(q[now[x] + 1], tag[x]))
    now[x]++;
}
void change(int x) {
  int bx = bel[x];
  for (int i = 1; i < bx; i++) tag[i]++, up(i);
  for (int i = bl[bx]; i <= x; i++) sum[i] += i;
  make(bx), up(bx);
}
pair<long long, int> finder(int x) {
  return make_pair(f(q[now[x]], tag[x]), q[now[x]]);
}
int main() {
  ios::sync_with_stdio(0), cout.tie(nullptr);
  n = ty(), per = ty();
  for (int i = 1, a, b; i <= n; i++)
    a = ty(), b = ty(), mxb = max(mxb, b), hav[b].emplace_back(a);
  for (int i = 1; i <= N; i++) bel[i] = (i - 1) / B + 1;
  for (int i = N; i >= 1; i--) bl[bel[i]] = i;
  for (int i = 1; i <= N; i++) br[bel[i]] = i;
  bcnt = bel[N];
  for (int i = 1; i <= bcnt; i++) make(i), up(i);
  long long got = n;
  pair<long long, int> ans{0, 0};
  for (int i = 0; i <= mxb + 1; i++) {
    cout << ans.first + per * got * i << ' ' << ans.second << lf;
    for (auto a : hav[i]) change(a), got--;
    for (int j = 1; j <= bcnt; j++) ans = max(ans, finder(j));
  }
  return 0;
}
