package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	h, w := scanInt(), scanInt()
	bit := binaryIndexedTreeInit(w)
	for i := 0; i < w; i++ {
		bit.add(i, 1)
	}

	inf := 1 << 60
	seg := segmentTreeInit(w, min, inf)
	seg.build(make([]int, w))

	for i := 0; i < h; i++ {
		a, b := scanInt()-1, scanInt()-1

		if b+1 < w && seg.data(b+1) == inf {
			s := bit.sum(b + 1)
			if s != 0 {
				k := bit.lowerbound(s)
				bit.add(b+1, 1)
				seg.update(b+1, b+1-k+seg.data(k))
			}
		}

		s := bit.sum(a-1) + 1
		for {
			k := bit.lowerbound(s)
			if k > b {
				break
			}
			bit.add(k, -1)
			seg.update(k, inf)
		}

		ans := seg.query(0, w)
		if ans == inf {
			fmt.Fprintln(wr, -1)
		} else {
			fmt.Fprintln(wr, ans+i+1)
		}
	}

}

type binaryIndexedTree []int

func binaryIndexedTreeInit(n int) binaryIndexedTree {
	return make(binaryIndexedTree, n+1)
}

func (t binaryIndexedTree) sum(i int) (s int) {
	for i++; i > 0; i -= i & -i {
		s += t[i]
	}
	return
}
func (t binaryIndexedTree) add(i, x int) {
	for i++; i < len(t) && i > 0; i += i & -i {
		t[i] += x
	}
}

func (t binaryIndexedTree) lowerbound(x int) int {
	idx, k := 0, 1
	for k < len(t) {
		k <<= 1
	}
	for k >>= 1; k > 0; k >>= 1 {
		if idx+k < len(t) && t[idx+k] < x {
			x -= t[idx+k]
			idx += k
		}
	}
	return idx
}

type segmentTree struct {
	arr []int
	e   int
	n   int
	fn  func(a, b int) int
}

func segmentTreeInit(n int, fn func(a, b int) int, e int) segmentTree {
	a := 1
	for a < n {
		a <<= 1
	}
	res := segmentTree{make([]int, 2*a), e, a, fn}
	for i := 0; i < 2*a; i++ {
		res.arr[i] = e
	}
	return res
}

func (seg segmentTree) build(arr []int) {
	for i := 0; i < len(arr); i++ {
		seg.arr[i+seg.n] = arr[i]
	}
	for i := seg.n - 1; i > 0; i-- {
		seg.arr[i] = seg.fn(seg.arr[2*i], seg.arr[2*i+1])
	}
}

func (seg segmentTree) update(i, a int) {
	i += seg.n
	seg.arr[i] = a
	for i >>= 1; i > 0; i >>= 1 {
		seg.arr[i] = seg.fn(seg.arr[2*i], seg.arr[2*i+1])
	}
}

func (seg segmentTree) query(a, b int) int {
	var query func(a, b, k, l, r int) int
	query = func(a, b, k, l, r int) int {
		if r <= a || b <= l {
			return seg.e
		}
		if a <= l && r <= b {
			return seg.arr[k]
		}
		return seg.fn(query(a, b, 2*k, l, (l+r)/2), query(a, b, 2*k+1, (l+r)/2, r))
	}
	return query(a, b, 1, 0, seg.n)
}

func (seg segmentTree) data(i int) int {
	return seg.arr[i+seg.n]
}


Measured memory_bytes: 12044