#include <algorithm>
#include <iostream>
#include <map>
#include <set>

int main()
{
    int H, W;
    std::cin >> H >> W;

    std::map<int, int> M;
    std::multiset<int> S;
    for (int i = 0; i < W; i++) {
        M[i] = i;
        S.insert(0);
    }

    for (int i = 0; i < H; i++) {
        int A, B;
        std::cin >> A >> B;
        A--;

        auto cur = M.lower_bound(A);
        int ma = -1;
        while (cur != M.end() and cur->first <= B) {
            ma = std::max(ma, cur->second);

            const int x = cur->first - cur->second;
            S.erase(S.find(x));
            M.erase(cur++);
        }

        if (ma != -1 and B < W) {
            S.insert(B - ma);
            M[B] = ma;
        }

        if (S.empty()) {
            std::cout << -1 << '\n';
        } else {
            std::cout << *S.begin() + i + 1 << '\n';
        }
    }
}