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;
int IN() {
  int c, f, x;
  while (!isdigit(c = getchar()) && c != '-')
    ;
  c == '-' ? (f = 1, x = 0) : (f = 0, x = c - '0');
  while (isdigit(c = getchar())) x = (x << 1) + (x << 3) + c - '0';
  return !f ? x : -x;
}
const int N = 100000 + 19;
const int S = 200;
const long long oo = 1ll << 60;
struct node {
  int a, b;
  bool operator<(const node &B) const { return b < B.b; }
} P[N];
int A[N], id[N];
int n, w, c, B;
pair<long long, int> res;
struct Vector {
  int x;
  long long y;
  int id;
  long long At(int v) const { return 1ll * x * v + y; }
} V[N];
Vector operator-(Vector A, Vector B) {
  return (Vector){A.x - B.x, A.y - B.y, 0};
}
inline long long cross(Vector A, Vector B) { return A.x * B.y - A.y * B.x; }
struct Block {
  int s[S + 19];
  int L, R, t, c, tag;
  pair<long long, int> ans;
  Block() {
    L = (1 << 30) - 1;
    R = -1;
  }
  void Renew() {
    for (; c + 1 <= t && V[s[c]].At(tag) < V[s[c + 1]].At(tag); c++)
      ;
    ans = make_pair(V[s[c]].At(tag), V[s[c]].id);
  }
  void Rebuild() {
    if (tag) {
      for (int i = L; i < R + 1; i++) V[i].y += 1ll * tag * V[i].x;
      tag = 0;
    }
    t = 0;
    for (int i = L; i < R + 1; i++) {
      for (; t >= 2 && cross(V[s[t - 1]] - V[s[t]], V[i] - V[s[t]]) < 0; t--)
        ;
      s[++t] = i;
    }
    c = 1;
    Renew();
  }
} Bl[N / S + 19];
int main() {
  n = IN(), w = IN();
  for (int i = 1; i < n + 1; i++) {
    P[i] = (node){IN(), IN()};
    A[++*A] = P[i].a;
    B = max(B, P[i].b);
  }
  A[++*A] = 0;
  sort(A + 1, A + *A + 1);
  *A = unique(A + 1, A + *A + 1) - A - 1;
  for (int i = 1; i < n + 1; i++) {
    P[i].a = lower_bound(A + 1, A + *A + 1, P[i].a) - A;
  }
  sort(P + 1, P + n + 1);
  c = 1;
  for (int i = 1; i < *A + 1; i++) V[i] = (Vector){A[i], 0, -i};
  for (int i = 1; i < *A + 1; i++) {
    id[i] = i / S + 1;
    Bl[id[i]].L = min(Bl[id[i]].L, i);
    Bl[id[i]].R = max(Bl[id[i]].R, i);
  }
  for (int i = 1; i < id[*A] + 1; i++) {
    Bl[i].Rebuild();
  }
  for (int i = 0; i < B + 2; i++) {
    res = make_pair(-oo, 0);
    for (int j = 1; j < id[*A] + 1; j++) res = max(res, Bl[j].ans);
    res.first += 1ll * i * w * (n - c + 1);
    printf("%I64d %d\n", res.first, A[-res.second]);
    for (; c <= n && P[c].b == i; c++) {
      int u = id[P[c].a];
      for (int j = 1; j < u; j++) {
        Bl[j].tag++;
        Bl[j].Renew();
      }
      for (int j = Bl[u].L; j < P[c].a + 1; j++) V[j].y += V[j].x;
      Bl[u].Rebuild();
    }
  }
}
