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


#define PR(a, n) {cerr << #a << " = "; for (int _=1; _<=n; ++_) cerr << a[_] <<' '; cerr << '\n';}
#define PR0(a, n) {cerr << #a << " = "; for (int _=0; _<n; ++_) cerr << a[_] <<' '; cerr << '\n';}
#define db(x) {cerr << #x << " = " << x << '\n';}
#define FILE_NAME "data"


const int INF = 1e9;


class SegmentTree {
public:
    struct Node {
        int sum, minPref, lazy;

        Node() {
            sum = 0;
            minPref = 0;
            lazy = -INF;
        }
    };

    int n;
    vector<Node> st;

    SegmentTree(int n): n(n) {
        st.resize(4 * n);
    }

    void updateFromChildren(int idx) {
        st[idx].sum = st[idx * 2].sum + st[idx * 2 + 1].sum;
        st[idx].minPref = min(st[idx * 2].minPref,
                              st[idx * 2].sum + st[idx * 2 + 1].minPref);
    }

    void intervalUpdate(int idx, int l, int r, int val) {
        st[idx].lazy = val;
        st[idx].sum = val * (r - l + 1);
        st[idx].minPref = min(val, val * (r - l + 1));
    }

    void down(int idx, int l, int r) {
        if (st[idx].lazy == -INF) {
            return;
        }

        int tmp = st[idx].lazy;
        st[idx].lazy = -INF;

        int mid = (l + r) / 2;
        intervalUpdate(idx * 2, l, mid, tmp);
        intervalUpdate(idx * 2 + 1, mid + 1, r, tmp);
    }

    void update(int u, int v, int val, int l, int r, int idx) {
        if (v < l || u > r) {
            return;
        }

        if (u <= l && r <= v) {
            intervalUpdate(idx, l, r, val);
            return;
        }

        down(idx, l, r);

        int mid = (l + r) / 2;
        update(u, v, val, l, mid, idx * 2);
        update(u, v, val, mid + 1, r, idx * 2 + 1);
        updateFromChildren(idx);
    }

    int getSum(int pos, int l, int r, int idx) {
        if (pos < l) {
            return 0;
        }

        if (r <= pos) {
            return st[idx].sum;
        }

        down(idx, l, r);

        int mid = (l + r) / 2;
        return getSum(pos, l, mid, idx * 2) + getSum(pos, mid + 1, r, idx * 2 + 1);
    }

    int getMinPrefixSum() {
        return st[1].minPref;
    }

    void update(int u, int v, int val) {
        if (u > v) {
            return;
        }

        update(u, v, val, 1, n, 1);
    }

    int getSum(int pos) {
        return getSum(pos, 1, n, 1);
    }
};


int main() {
    #ifdef ACM
        freopen(FILE_NAME".in", "r", stdin);
    #endif

    int H, W;
    cin >> H >> W;

    SegmentTree tr(W);
    for (int i = 1; i <= H; ++i) {
        int l, r;
        cin >> l >> r;

        if (l == 1) {
            int fr = tr.getSum(r + 1);
            tr.update(1, 1, INF);
            tr.update(2, r, 0);
            tr.update(r + 1, r + 1, fr + 1 - INF);
        }
        else {
            int fr = tr.getSum(r + 1);
            tr.update(1, 1, tr.getSum(1) + 1);
            tr.update(l, r, 1);
            tr.update(r + 1, r + 1, fr + 1 - tr.getSum(r));
        }

        // for (int i = 1; i <= W; ++i) {
        //     cerr << tr.getSum(i) << ' ';
        // }
        // cerr << '\n';

        int res = tr.getMinPrefixSum();
        if (res < INF) {
            cout << res << '\n';
        }
        else {
            cout << -1 << '\n';
        }
    }
}


Measured memory_bytes: 12728