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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define INF 10000000000
#define MOD 1000000007
using ll = long long;
using pint = pair<int,int>;
using pll = pair<ll,ll>;
using Graph = vector<vector<int>>;

int main(){
    int H,W; cin>>H>>W;
    map<int,int> S;//S[now] = start_ind
    multiset<int> vals;//横方向の差分の集合
    //__init__
    rep(i,W)S[i] = i;
    rep(i,W)vals.insert(0);

    rep(i,H){
        int l,r; cin>>l>>r;
        --l;
        auto it = S.lower_bound(l);//obstacle 上 now;
        int mr = -1;
        while(it != S.end() && it->first <= r){
            //削除候補
            mr = max(mr,it->second);//startの候補を削除
            vals.erase(vals.find(it->first-it->second));
            S.erase(it++);
        }
        if(mr != -1 && r < W){
            vals.insert(r-mr);
            S[r] = mr;
        }
        int ans = -1;
        if(vals.size()>0){
            ans = *vals.begin() + (i+1);
        }
        cout<<ans<<endl;
    }
    return 0;
}