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;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline long long rand(long long x, long long y) {
  return (rng() % (y + 1 - x)) + x;
}
string inline to_string(char c) {
  string second(1, c);
  return second;
}
template <typename T>
inline T gcd(T a, T b) {
  return a == 0 ? b : gcd(b % a, a);
}
const long long int sqn = 400;
const long long int other = (100006) / sqn + 1;
struct convex_hull {
  deque<pair<long long int, long long int> > dq;
  long long int first(pair<long long int, long long int> line,
                      long long int x) {
    return line.first * x + line.second;
  }
  pair<long long int, long long int> query(long long int x) {
    while (dq.size() > 1) {
      if (first(dq[0], x) < first(dq[1], x))
        dq.pop_front();
      else
        break;
    }
    return pair<long long int, long long int>(first(dq[0], x), dq[0].first);
  }
  long double intersect(long long int m1, long long int c1, long long int m2,
                        long long int c2) {
    return (long double)(c2 - c1) / (long double)(m1 - m2);
  }
  long double intersect(pair<long long int, long long int> line1,
                        pair<long long int, long long int> line2) {
    return intersect(line1.first, line1.second, line2.first, line2.second);
  }
  void insert(long long int m, long long int c) {
    pair<long long int, long long int> line =
        pair<long long int, long long int>(m, c);
    while (dq.size() > 1) {
      long long int second = dq.size();
      if (intersect(dq[second - 1], line) <= intersect(dq[second - 2], line))
        dq.pop_back();
      else
        break;
    }
    dq.push_back(line);
  }
} ch[other + 5];
long long int n, w, mb, C[(100006)], G[(100006)], mp;
vector<long long int> v[(100006)];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> w;
  for (long long int i = (0); i <= (long long int)(n - 1); ++i) {
    long long int a, b;
    cin >> a >> b;
    mb = max(mb, b), mp = max(mp, a);
    v[b].push_back(a);
  }
  auto build = [&](long long int i) {
    ch[i].dq.clear();
    ch[i].insert(0, 0);
    for (long long int j = (i * sqn);
         j <= (long long int)(min((i + 1) * sqn - 1, mp)); ++j) {
      ch[i].insert(j, C[j]);
    }
  };
  for (long long int i = (0); i <= (long long int)(other); ++i) build(i);
  long long int ppl = n;
  for (long long int i = (0); i <= (long long int)(mb + 1); ++i) {
    pair<long long int, long long int> ans =
        pair<long long int, long long int>(0, 0);
    for (long long int j = (0); j <= (long long int)(other); ++j) {
      ans = max(ans, ch[j].query(G[j]));
    }
    cout << ans.first + i * w * ppl << ' ' << ans.second << '\n';
    ppl -= v[i].size();
    for (auto j : v[i]) {
      for (int i = 0; i <= j; i += sqn) ++G[i / sqn];
      for (int i = j + 1; i <= min(mp, (j / sqn + 1) * sqn - 1); ++i) {
        C[i] -= i;
      }
      build(j / sqn);
    }
  }
}