#include <bits/stdc++.h>
using namespace std;
using lint = long long;

// Author: Rama Aryasuta Pangestu
// Date: 2020-05-15
// Source: own work
//
// Supports the following operations online:
// 1 A[i] = max(A[i], a * i + b) for i = [l, r], given (l, r, a, b) in O(\log^2 C) time, O(\log C) additional memory
// 2 A[i] += x for i = [l, r], given (l, r, x) in O(\log^2 C) time, O(\log C) addtional memory
// 3 return max(A[i]) for i = [l, r], given(l, r) in O(\log C) time

const long long inf = 1e9;

template<typename data_t>
struct Line {
  data_t a, b;
  Line() : a(0), b(-inf) {}
  Line(data_t a, data_t b) : a(a), b(b) {}
  data_t get(data_t x) {
    return a * x + b;
  }
  void add(Line x) {
    a += x.a;
    b += x.b;
  }
};

class LiChao {
 private:
  using data_t = long long;
  struct Node {
    Line<data_t> line = Line<data_t>();
    Line<data_t> lazy = Line<data_t>(0, 0);
    
    data_t maximum = -inf;

    Node *lc = nullptr;
    Node *rc = nullptr;

    void apply(data_t l, data_t r, Line<data_t> v) {
      line.add(v);
      lazy.add(v);
      maximum = max(-inf, maximum + v.b);
      maximum = max(maximum, line.get(l));
      maximum = max(maximum, line.get(r));
    }
  };

  data_t sz;
  Node *root = nullptr;

  void PushLazy(Node* &n, data_t tl, data_t tr) {
    if (n == nullptr) return;
    if (n->lc == nullptr) n->lc = new Node();
    if (n->rc == nullptr) n->rc = new Node();
    data_t mid = (tl + tr) / 2;
    n->lc->apply(tl, mid, n->lazy);
    n->rc->apply(mid + 1, tr, n->lazy);
    n->lazy = Line<data_t>(0, 0);
  }

  void PushLine(Node* &n, data_t tl, data_t tr) {
    if (n == nullptr) return;
    data_t mid = (tl + tr) / 2;
    InsertLineKnowingly(n->lc, tl, mid, n->line);
    InsertLineKnowingly(n->rc, mid + 1, tr, n->line);
    n->line = Line<data_t>();
  }

  void PullMaximum(Node* &n, data_t tl, data_t tr) {
    if (n == nullptr) return;
    n->maximum = -inf;
    if (n->lc != nullptr) n->maximum = max(n->maximum, n->lc->maximum);
    if (n->rc != nullptr) n->maximum = max(n->maximum, n->rc->maximum);
    n->maximum = max(n->maximum, n->line.get(tl));
    n->maximum = max(n->maximum, n->line.get(tr));
  }

  void InsertLineKnowingly(Node* &n, data_t tl, data_t tr, Line<data_t> x) {
    if (n == nullptr) n = new Node();
    if (n->line.get(tl) < x.get(tl)) swap(n->line, x);
    if (tl != tr) PushLazy(n, tl, tr);
    if (n->line.get(tr) < x.get(tr) && tl != tr) {
      data_t mid = (tl + tr) / 2;
      if (n->line.get(mid) > x.get(mid)) {
        InsertLineKnowingly(n->rc, mid + 1, tr, x);
      } else {
        swap(n->line, x);
        InsertLineKnowingly(n->lc, tl, mid, x);
      }
    }
    PullMaximum(n, tl, tr);
  }

  void InsertLine(Node* &n, data_t tl, data_t tr, data_t l, data_t r, Line<data_t> x) {
    if (tr < l || r < tl || tl > tr || l > r) return;
    if (n == nullptr) n = new Node();
    if (l <= tl && tr <= r) return InsertLineKnowingly(n, tl, tr, x);
    data_t mid = (tl + tr) / 2;
    PushLazy(n, tl, tr);
    InsertLine(n->lc, tl, mid, l, r, x);
    InsertLine(n->rc, mid + 1, tr, l, r, x);
    PullMaximum(n, tl, tr);
  }

  void AddLine(Node* &n, data_t tl, data_t tr, data_t l, data_t r, Line<data_t> x) {
    if (tr < l || r < tl || tl > tr || l > r) return;
    if (n == nullptr) n = new Node();
    if (l <= tl && tr <= r) return n->apply(tl, tr, x);
    data_t mid = (tl + tr) / 2;
    PushLazy(n, tl, tr);
    PushLine(n, tl, tr);
    AddLine(n->lc, tl, mid, l, r, x);
    AddLine(n->rc, mid + 1, tr, l, r, x);
    PullMaximum(n, tl, tr);
  }

  data_t Query(Node* &n, data_t tl, data_t tr, data_t l, data_t r) {
    if (tr < l || r < tl || tl > tr || l > r) return -inf;
    if (n == nullptr) return -inf;
    if (l <= tl && tr <= r) return n->maximum;
    data_t mid = (tl + tr) / 2;
    data_t res = max(n->line.get(max(l, tl)), n->line.get(min(r, tr)));
    PushLazy(n, tl, tr);
    res = max(res, Query(n->lc, tl, mid, l, r));
    res = max(res, Query(n->rc, mid + 1, tr, l, r));
    PullMaximum(n, tl, tr);
    return res;
  }

 public:
  LiChao() {}
  LiChao(data_t sz) : sz(sz) {}
  
  void InsertLine(data_t l, data_t r, Line<data_t> x) {
    return InsertLine(root, 0, sz - 1, l, r, x);
  }
  void AddLine(data_t l, data_t r, Line<data_t> x) {
    assert(x.a == 0);
    return AddLine(root, 0, sz - 1, l, r, x);
  }
  data_t Query(data_t l, data_t r) {
    return max(-inf, Query(root, 0, sz - 1, l, r));
  }
};

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);

  int H, W;
  cin >> H >> W;
  LiChao li_chao(W);
  li_chao.InsertLine(0, W - 1, Line<lint>(0, 0));
  for (int i = 0; i < H; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    li_chao.AddLine(a, b, Line<lint>(0, -1e9));
    li_chao.AddLine(0, W - 1, Line<lint>(0, -1));
    if (a > 0) {
      lint opt = -li_chao.Query(a - 1, a - 1);
      li_chao.InsertLine(a, b, Line<lint>(-1, a - opt - 1));
    }
    lint ans = -li_chao.Query(0, W - 1);
    if (ans >= 1e7) {
      ans = -1;
    }
    cout << ans << "\n";
  }
  return 0;
}


Measured memory_bytes: 28572