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>
int n, w, a[100001], b[100001];
struct ktt {
  long long t[1000001], lazy[1000001], a[200001];
  std::pair<long long, long long> mx[1000001];
  int pos[1000001];
  void pushdown(int x, int y) {
    lazy[x] += y;
    t[x] -= y;
    mx[x].first += mx[x].second * y;
  }
  void spread(int x) {
    if (lazy[x]) {
      pushdown(x << 1, lazy[x]);
      pushdown(x << 1 | 1, lazy[x]);
      lazy[x] = 0;
    }
  }
  long long calc(const std::pair<long long, long long> &a,
                 const std::pair<long long, long long> &b) {
    if (a.second >= b.second) return 1e18;
    return (a.first - b.first) / (b.second - a.second);
  }
  void pushup(int x) {
    t[x] = std::min(t[x << 1], t[x << 1 | 1]);
    if (mx[x << 1].first < mx[x << 1 | 1].first) {
      mx[x] = mx[x << 1 | 1];
      t[x] = std::min(t[x], calc(mx[x << 1 | 1], mx[x << 1]));
    } else {
      mx[x] = mx[x << 1];
      t[x] = std::min(t[x], calc(mx[x << 1], mx[x << 1 | 1]));
    }
  }
  void rebuild(int x) {
    if (t[x] >= 0) return;
    spread(x);
    rebuild(x << 1);
    rebuild(x << 1 | 1);
    pushup(x);
  }
  void update(int root, int l, int r, int el, int er, long long x) {
    if (el > r || er < l) return;
    if (el <= l && er >= r) {
      pushdown(root, x);
      if (t[root] < x) rebuild(root);
      return;
    }
    spread(root);
    update(root << 1, l, (l + r) >> 1, el, er, x);
    update(root << 1 | 1, ((l + r) >> 1) + 1, r, el, er, x);
    pushup(root);
  }
  long long query(int root, int l, int r, int el, int er) {
    if (el > r || er < l) return -1e18;
    spread(root);
    if (el <= l && er >= r) return mx[root].first;
    return std::max(query(root << 1, l, (l + r) >> 1, el, er),
                    query(root << 1 | 1, ((l + r) >> 1) + 1, r, el, er));
  }
  void set(int root, int l, int r, int e, long long x) {
    if (l == r) {
      mx[root].first = x;
      return;
    }
    spread(root);
    if ((l + r) >> 1 >= e)
      set(root << 1, l, (l + r) >> 1, e, x);
    else
      set(root << 1 | 1, ((l + r) >> 1) + 1, r, e, x);
    pushup(root);
  }
  void build(int root, int l, int r) {
    if (l == r) {
      mx[root].second = a[l];
      t[root] = 1e18;
      return;
    }
    build(root << 1, l, (l + r) >> 1);
    build(root << 1 | 1, ((l + r) >> 1) + 1, r);
    pushup(root);
  }
} t;
std::vector<int> vec[100010];
int read() {
  int x = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return x;
}
void write(long long x) {
  if (x > 9) write(x / 10);
  putchar((x % 10) + '0');
}
int main() {
  n = read(), w = read();
  int mx = 0;
  for (int i = 1; i <= n; i++) {
    a[i] = read(), b[i] = read();
    mx = std::max(mx, b[i]);
    vec[b[i]].push_back(a[i]);
  }
  for (int i = 1; i <= 100000; i++) t.a[i] = i;
  t.build(1, 1, 100000);
  int cnt = n;
  for (int i = 0; i <= mx + 1; i++) {
    write(1ll * cnt * i * w + t.mx[1].first), putchar(' ');
    write(t.mx[1].second), putchar('\n');
    for (int j = 0; j < vec[i].size(); j++)
      --cnt, t.update(1, 1, 100000, 1, vec[i][j], 1);
  }
}