#include <bits/stdc++.h>

#define ll long long
#define str string
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fi first
#define se second

#define vc vector<char>
#define vvc vector<vc>
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vi>
#define vvll vector<vll>
#define vvvll vector<vvll>
#define vs vector<str>
#define vvs vector<vs>
#define vpii vector<pii>
#define vvpii vector<vpii>
#define vpll vector<pll>
#define vvpll vector<vpll>
#define vb vector<bool>
#define vvb vector<vb>
#define rep(i, a, b) for (int i = (a); i < int(b); i++)
#define repi(i, a, b) for (int i = (a); i <= int(b); i++)


using namespace std;
ll INF = LONG_LONG_MAX;
ll mod = 1000000000 + 7;

template <typename T, typename L>
void read(vector<T> & _data, L & _size, bool _shift) {
    _data.resize(_size + (ll)_shift);
    for (ll i = (ll)_shift; i < _size + (ll)_shift; i++)
        cin >> _data[i];
}

template <typename T, typename L>
void read(vector<vector<T>> & _data, L & _rows, L & _cols, bool _shiftRows, bool _shiftCols) {
    _data.resize(_rows + (ll)_shiftRows);
    for (ll i = 0; i < _rows + (ll)_shiftRows; i++)
        _data[i].resize(_cols + (ll)_shiftCols);
    for (ll i = (ll)_shiftRows; i < _rows + (ll)_shiftRows; i++)
        for (ll j = (ll)_shiftCols; j < _cols + (ll)_shiftCols; j++)
            cin >> _data[i][j];
}

template <typename T>
void write(vector<T> & _data, bool _shift) {
    for (ll i = (ll)_shift; i < _data.size(); i++)
        cout << _data[i] << " ";
    cout << endl;
}


//TODO: SOLUTION

ll h, w;
vll l, r;

void solve() {
    cin >> h >> w;
    l.resize(h + 1);
    r.resize(h + 1);
    repi(i, 1, h) {
        cin >> l[i] >> r[i];
    }

    set<pll> s;
    map<ll, ll> m;
    m[0] = 0;

    repi(i, 1, w) {
        s.insert({i, i});
        m[0]++;
    }

    ll x = 1;
    while (x != h + 1) {
        auto it = s.lower_bound({l[x], 0});
        ll ans = INF;
        vpll todel;
        vpll toins;
        while (it != s.end() && it->first <= r[x]) {
            //cout << it->fi << " "<< it->se << ", ";
            toins.push_back({r[x] + 1, it->second});
            todel.push_back({it->first, it->second});
            it++;
        }
        for (auto p : todel) {
            m[p.first - p.second]--;
            if (m[p.first - p.second] == 0)
                m.erase(p.first - p.second);
            s.erase(p);
            //cout << "delete " << p.second << ":" << p.first << endl;
        }

        if (!toins.empty()) {
            auto p = toins[toins.size() - 1];
            //cout << "insert " << p.se << ":" << p.fi << endl;
            if (m.count(p.first - p.second) && p.first <= w)
                m[p.first - p.second]++;
            else if (p.first <= w)
                m[p.first - p.second] = 1;
            if (p.first <= w)
                s.insert(p);
        }
        if (m.empty()) {
            cout << -1 << endl;
        }
        else {
            cout << x + m.begin()->fi << endl;
        }
        x++;
    }
}


int main() {

    // TODO: Set value of this variable manually
    bool _multipleTestCases = false;

    if (_multipleTestCases) {
        ll t; cin >> t;
        while (t--)
            solve();
    }
    else {
        solve();
    }

    return 0;
}
/*Hatsune Miku 4ever!*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define _for(i,a,b) for(int i = (a);i < b;i ++)
#define _rep(i,a,b) for(int i = (a);i > b;i --)
#define INF 0x3f3f3f3f
#define mod 1000000007
#define lowbit(x) ((x)&(-x))
#define pb push_back
#define MIKU 39
#define Design ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define debug() printf("Miku Check OK!\n")
#define maxn 200039

int n, m;
struct SegTree
{
	struct SegNode
	{
		int l,r; 
		ll add;
		ll ans;
		#define l(x) tree[x].l
		#define r(x) tree[x].r
		#define add(x) tree[x].add
		#define ANS(x) tree[x].ans
	}tree[maxn<<2];
	void build(int p,int l,int r)
	{
		add(p) = 0;
		l(p) = l,r(p) = r;
		if(l==r)
		{
			ANS(p) = 0;
			return ;
		}
		int mid = (l+r)/2;
		build(p*2, l, mid);
		build(p*2+1, mid+1, r);
	}

	void spread(int p)
	{
		if(add(p))
		{
			ANS(p*2) = l(p) - add(p);
			ANS(p*2+1) = (l(p)+r(p))/2+1-add(p); 
			add(p*2) = add(p);
			add(p*2+1) = add(p);
			add(p) = 0;
		} 
	}
	void change(int p,int l,int r,ll d)
	{
		if(l <= l(p) && r >= r(p))
		{
			ANS(p) = l(p) - d;
			add(p) = d;
			return ;
		} 
		spread(p);
		int mid = (l(p)+r(p))/2;
		if(l <= mid)
			change(p*2, l, r, d);
		if(r > mid)
			change(p*2+1, l, r, d);
		ANS(p) = min(ANS(p*2),ANS(p*2+1));
	}
	ll ask(int p,int pos)
	{
		if(l(p)==r(p))
			return pos - ANS(p);
		spread(p);
		int mid = (l(p)+r(p))/2;
		if(pos <= mid)
			return ask(p*2, pos);
		else
			return ask(p*2+1, pos);
	}
}T;

int main()
{
	int H, W;
	scanf("%d%d",&H,&W);
	T.build(1,1,W);
	int now = 1;
	_for(i,1,H+1)
	{
		int a, b;
		scanf("%d%d",&a,&b);
		if(now < a)
			T.change(1,a,b,T.ask(1,a-1));
		else if(now >= a && now <= b)
		{
			T.change(1,now,b,-1000000);
			now = b+1;
		}
		if(now > W)
			printf("-1\n");
		else
			printf("%lld\n",T.tree[1].ans+i);
	} 
	return 0;
}