//#pragma GCC target("avx2")
#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << "\n";
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

/* memo
 * op, up_d, up_l should be lambda functions such as:
 *  auto op = [](ll a, ll b) { return min(a, b); };
 *  auto up_d = [](ll &d, ll v) { d += v; };
 *  auto up_l = [](ll &l, ll v) { l += v; };
 *  (In this case, the instance should be Starry Sky Tree.)
**/

// segment tree with lazy propagation
template<class T>
struct LazySegTree {
    using OP = function<T(T, T)>;  // function type for operation
    using UP = function<void(T &, T)>; // function type for updater

    OP op;
    UP up_d, up_l;
    T ue_d, ue_l; // unit element for dat and lazy
    int N;
    vector<T> dat, lazy;

    int get_n(int n) {
        int ret = 1;
        while (ret < n) ret <<= 1;

        return ret;
    }

    explicit LazySegTree(int n, const OP _op, const UP _up_d, const UP _up_l,
                         const T _ue_d, const T _ue_l)
            : op(_op), up_d(_up_d), up_l(_up_l), ue_d(_ue_d), ue_l(_ue_l) {
        N = get_n(n);
        dat.assign(N * 2 - 1, ue_d);
        lazy.assign(N * 2 - 1, ue_l);
    }

    /* set, a is 0-indexed */
    void init(const T& v) {
        REP(i, N) dat[i + N - 1] = v;
        for(int i = N - 2; i >= 0; --i) {
            dat[i] = op(dat[i*2+1], dat[i*2+2]);
        }
    }

    inline void evaluate(int k) {
        if (lazy[k] == ue_l) return;

        if (k < N - 1) {
            up_l(lazy[k * 2 + 1], lazy[k]);
            up_l(lazy[k * 2 + 2], lazy[k]);
        }

        up_d(dat[k], lazy[k]);
        lazy[k] = ue_l;
    }

    // update [a, b). 0-indexed!!!!!!!!!!!
    void update(int a, int b, const T &v, int k = 0, int l = 0, int r = -1) {
        evaluate(k);
        if (r < 0) r = N;

        if (r <= a || b <= l) return;

        if (a <= l && r <= b) {
            up_l(lazy[k], v);
            evaluate(k);
            return;
        }

        int mid = (l + r) / 2;
        update(a, b, v, k * 2 + 1, l, mid);
        update(a, b, v, k * 2 + 2, mid, r);

        dat[k] = op(dat[k * 2 + 1], dat[k * 2 + 2]);
    }

    // update single position
    void update(int i, const T &v) {
        update(i, i+1, v);
    }

    // query for [a, b). 0-indexed!!!!!!!!!!!
    T query(int a, int b, int k = 0, int l = 0, int r = -1) {
        if (r < 0) r = N;

        if (r <= a || b <= l) return ue_d;

        evaluate(k);
        if (a <= l && r <= b) return dat[k];

        int mid = (l + r) / 2;
        T q1 = query(a, b, k * 2 + 1, l, mid);
        T q2 = query(a, b, k * 2 + 2, mid, r);

        return op(q1, q2);
    }

    void debug_() {
#ifdef LOCAL
        int c = 1;

        /* dat */
        cout << "### dat ###" << endl;

        REP(i, dat.size()) {
            if (i == c) {
                cout << endl;
                c = (c << 1) + 1;
            }
            cout << dat[i] << " ";
        }
        cout << endl;

        c = 1;
        /* lazy */
        cout << "### lazy ###" << endl;

        REP(i, lazy.size()) {
            if (i == c) {
                cout << endl;
                c = (c << 1) + 1;
            }
            cout << lazy[i] << " ";
        }

        cout << endl;
#endif
    }
};

void solve1() {
    int h, w;
    cin >> h >> w;

    map<int, int> s;
    multiset<int> vals;

    REP(i, w) s[i] = i;
    REP(i, w) vals.insert(0);

    REP(i, h) {
        int l, r;
        cin >> l >> r;
        --l;

        int l_max = -1;
        auto it = s.lower_bound(l);
        while(it != s.end() && it->fi <= r) {
            l_max = max(l_max, it->se);
            vals.erase(vals.find(it->fi - it->se));
            s.erase(it++);
        }

        if(l_max != -1 && r < w){
            s[r] = l_max;
            vals.insert(r - l_max);
        }

        if (vals.size() == 0) print(-1);
        else print(*vals.begin() + i + 1);
    }
}

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    solve1();
}


Measured memory_bytes: 22372