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 <class T>
inline void umax(T &a, T b) {
  if (a < b) a = b;
}
template <class T>
inline void umin(T &a, T b) {
  if (a > b) a = b;
}
template <class T>
inline T abs(T a) {
  return a > 0 ? a : -a;
}
template <class T>
inline T gcd(T a, T b) {
  return __gcd(a, b);
}
template <class T>
inline T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
const int inf = 1e9 + 143;
const long long longinf = 1e18 + 143;
inline int read() {
  int x;
  scanf(" %d", &x);
  return x;
}
const int N = 101010;
const int BLOCK = 200;
const int K = N / BLOCK + 10;
struct data {
  int a, b, id;
};
data a[N];
int opt[N];
long long pay[N];
bool bya(const data &a, const data &b) { return a.a > b.a; }
bool byb(const data &a, const data &b) { return a.b < b.b; }
struct line {
  long long m, n;
  line(long long _m = 0, long long _n = 0) {
    m = _m;
    n = _n;
  }
  long long calc(long long x) { return x * m + n; }
  bool operator<(const line &a) const {
    if (m == a.m) return n > a.n;
    return m < a.m;
  }
};
double cross(line L1, line L2) { return (double)(L1.n - L2.n) / (L2.m - L1.m); }
inline bool bad(line L1, line L2, line L3) {
  return cross(L1, L3) < cross(L1, L2);
}
class convex {
 public:
  line st[BLOCK + 5];
  int push, ptr;
  void clear() {
    push = 0;
    ptr = 1;
  }
  void add_line(line L) {
    while (push >= 2 && bad(st[push - 1], st[push], L)) push--;
    st[++push] = L;
  }
  pair<long long, int> get(int x) {
    if (push == 0) return make_pair(0ll, 0);
    if (ptr > push) ptr = push;
    while (ptr < push && st[ptr].calc(x) < st[ptr + 1].calc(x)) ++ptr;
    return make_pair(st[ptr].calc(x), st[ptr].m);
  }
};
class solver {
 public:
  convex cht;
  vector<int> vs;
  int add;
  solver() {
    add = 0;
    cht.clear();
    vs.clear();
  }
  void insert(int x) {
    vector<line> ls;
    cht.clear();
    vs.push_back(x);
    sort(vs.rbegin(), vs.rend());
    for (int i = 0; i < vs.size(); i++) {
      ls.push_back(line(vs[i], (long long)vs[i] * (i + 1)));
    }
    sort(ls.begin(), ls.end());
    for (int i = 0; i < ls.size(); i++) {
      if (i == 0 || ls[i - 1].m != ls[i].m) cht.add_line(ls[i]);
    }
  }
  pair<long long, int> getmax() {
    if (!vs.size()) return make_pair(-1, -1);
    return cht.get(add);
  }
};
solver T[K];
int main() {
  int n = read();
  int w = read();
  int maxb = 0;
  for (int i = 0; i < n; i++) {
    a[i].a = read();
    a[i].b = read();
    umax(maxb, a[i].b);
  }
  sort(a, a + n, bya);
  for (int i = 0; i < n; i++) {
    a[i].id = i;
  }
  sort(a, a + n, byb);
  printf("0 0\n");
  int ptr = 0;
  for (int c = 1; c <= maxb + 1; c++) {
    while (ptr < n && a[ptr].b < c) {
      T[a[ptr].id / BLOCK].insert(a[ptr].a);
      for (int i = a[ptr].id / BLOCK + 1; i < K; i++) ++T[i].add;
      ptr++;
    }
    pair<long long, int> res;
    res = make_pair(0, 0);
    for (int i = 0; i < K; i++) umax(res, T[i].getmax());
    printf("%I64d %d\n", res.first + 1ll * c * w * (n - ptr), res.second);
  }
  return 0;
}
