#include <bits/stdc++.h>
using namespace std;
const int M = 1e5 + 5, LG = 26, SM = 350, inf = 1e9 + 1, mod = 95542721;
set<int> se;
set<int>::iterator vasat;
int rotbe;
int ted[M];
long long int ans;
int ansp;
int rng = 1687;
void ins(int x) {
  rotbe += (x >= *vasat);
  ted[x]++;
  se.insert(x);
  auto vst2 = vasat;
  int rtbt2 = rotbe;
  if (x >= *vasat) {
    auto ite = vasat;
    int rot = rotbe;
    for (int rep = 0; rep < rng; rep++) {
      if (1LL * (*ite) * rot > ans) {
        rtbt2 = rot;
        vst2 = ite;
        ans = 1LL * (*ite) * rot;
        ansp = *ite;
      }
      rot -= ted[*ite];
      ite++;
      if (ite == se.end()) break;
    }
  } else {
    auto ite = vasat;
    int rot = rotbe;
    for (int rep = 0; rep < rng; rep++) {
      if (1LL * (*ite) * rot > ans) {
        rtbt2 = rot;
        vst2 = ite;
        ans = 1LL * (*ite) * rot;
        ansp = *ite;
      }
      if (ite == se.begin()) break;
      ite--;
      rot += ted[*ite];
    }
  }
  rotbe = rtbt2;
  vasat = vst2;
}
int n, w;
vector<int> b[M];
int main() {
  ted[0]++;
  se.insert(0);
  vasat = se.begin();
  rotbe = 1;
  scanf("%d%d", &n, &w);
  int mxb = 0;
  for (int i = 0; i < n; i++) {
    int ai, bi;
    scanf("%d%d", &ai, &bi);
    mxb = max(mxb, bi);
    b[bi].push_back(ai);
  }
  mxb += 2;
  int tnaf = n;
  for (int c = 0; c < mxb; c++) {
    printf("%lld %d\n", ans + 1LL * tnaf * c * w, ansp);
    for (int y : b[c]) {
      ins(y);
      tnaf--;
    }
  }
}
