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 T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << "{";
  for (const T &a : v) out << a << ", ";
  out << "}";
  return out;
}
template <typename S, typename T>
ostream &operator<<(ostream &out, const pair<S, T> &p) {
  out << "(" << p.first << ", " << p.second << ")";
  return out;
}
const int INF = 1000000001;
const int dx[] = {0, 0, -1, 1};
const int dy[] = {-1, 1, 0, 0};
struct line {
  long long a, b;
  mutable long long x0, x1;
  long long val(long long first) const { return a * first + b; }
  bool above(const line &k) {
    return val(k.x0) >= k.val(k.x0) && val(k.x1 - 1) >= k.val(k.x1 - 1);
  }
  bool operator<(const line &rhs) const {
    return a != rhs.a ? a < rhs.a : b < rhs.b;
  }
};
inline long long ceil(long long a, long long b) {
  if ((a ^ b) > 0) a += b + 2 * (b < 0) - 1;
  return a / b;
}
void add_line(vector<line> &lines, long long a, long long b) {
  line k({a, b, -INF, INF});
  vector<line>::iterator s, t;
  s = lines.end();
  while (s != lines.begin()) {
    if (!k.above(*--s)) {
      s++;
      break;
    } else {
      lines.pop_back();
      s = lines.end();
    }
  }
  lines.push_back(k);
  s = --lines.end();
  t = lines.end();
  if (s != lines.begin()) {
    t = s--;
    s->x1 = t->x0 = ceil(s->b - t->b, t->a - s->a);
  }
  if (s->x0 == s->x1) lines.erase(s);
}
pair<long long, int> get_max(vector<line>::iterator &it, long long first) {
  while (first >= it->x1) ++it;
  return pair<long long, int>(it->val(first), it->a);
}
const int B = 320;
const int MAXN = B * B;
int data[MAXN];
void add(int i, int v) {
  for (; i < MAXN; i |= i + 1) data[i] += v;
}
int sum(int i) {
  int s = 0;
  while (i >= 0) {
    s += data[i];
    i = (i & (i + 1)) - 1;
  }
  return s;
}
int sum(int a, int b) { return sum(b) - sum(a - 1); }
int X[B];
vector<line> lines[B];
vector<line>::iterator it[B];
void dorzuc(int a) {
  int v = 0;
  add(a, 1);
  while (v * B + B <= a) {
    ++X[v];
    ++v;
  }
  X[v] = 0;
  lines[v].clear();
  for (int i = (0); i < (B); ++i)
    add_line(lines[v], v * B + i,
             (long long)sum(v * B + i, MAXN - 1) * (v * B + i));
  it[v] = lines[v].begin();
}
void wypisz(long long bonus) {
  pair<long long, int> best = pair<int, int>(0, 0);
  for (int v = (0); v < (B); ++v) {
    pair<long long, int> cur = get_max(it[v], X[v]);
    best = max(best, cur);
  }
  printf("%I64d %d\n", best.first + bonus, best.second);
}
int n, w, k;
vector<pair<int, int> > V;
int main() {
  scanf("%d %d", &n, &w);
  for (int i = (0); i < (n); ++i) {
    int a, b;
    scanf("%d %d", &a, &b);
    V.push_back(pair<int, int>(b, a));
    k = max(k, b);
  }
  sort((V).begin(), (V).end());
  for (int v = (0); v < (B); ++v) {
    for (int i = (0); i < (B); ++i) add_line(lines[v], v * B + i, 0);
    it[v] = lines[v].begin();
  }
  int i = 0;
  for (int c = (0); c < (k + 2); ++c) {
    while (i < ((int)(V).size()) && V[i].first < c) {
      dorzuc(V[i].second);
      ++i;
    }
    wypisz((long long)(n - i) * c * w);
  }
  return 0;
}
