package main

import (
	"bufio"
	"container/heap"
	"fmt"
	"os"
	"strconv"
)

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	h := getNextInt(scanner)
	w := getNextInt(scanner)
	seg := newSegment(w + 1)
	pp := make(pairs, w)
	index = make([]int, w)
	for i := 0; i < w; i++ {
		pp[i][0] = i
		pp[i][1] = i
		index[i] = i
		seg.update(i, 1, seg.add)
	}
	p := &pp
	heap.Init(p)
	for i := 0; i < h; i++ {
		a := getNextInt(scanner) - 1
		b := getNextInt(scanner)
		v := -1
		for a < b {
			a = seg.right(0, a, 1)
			if a < b {
				seg.update(a, 0, seg.add)
				if v < pp[index[a]][1] {
					v = pp[index[a]][1]
				}
				heap.Remove(p, index[a])
			}
		}
		if b < w && v != -1 {
			if seg[0][b] == 1 {
				if v < pp[index[b]][1] {
					v = pp[index[b]][1]
				}
				heap.Remove(p, index[b])
			}
			heap.Push(p, pair{b, v})
			seg.update(b, 1, seg.add)
		}
		if p.Len() == 0 {
			fmt.Fprintln(writer, -1)
			continue
		}
		fmt.Fprintln(writer, pp[0][0]-pp[0][1]+i+1)
	}
}

var index []int

type pair [2]int

type pairs []pair

func (h pairs) Len() int { return len(h) }
func (h pairs) Less(i, j int) bool {
	return h[i][0]-h[i][1] < h[j][0]-h[j][1]
}
func (h pairs) Swap(i, j int) {
	h[i], h[j] = h[j], h[i]
	index[h[i][0]] = i
	index[h[j][0]] = j
}
func (h *pairs) Push(x interface{}) {
	y := x.(pair)
	index[y[0]] = h.Len()
	*h = append(*h, y)
}
func (h *pairs) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	index[x[0]] = -1
	*h = old[0 : n-1]
	return x
}

type segment [][]int

func newSegment(n int) segment {
	seg := make(segment, 0)
	for n > 1 {
		seg = append(seg, make([]int, n))
		n = (n + 1) >> 1
	}
	seg = append(seg, make([]int, 1))
	return seg
}
func (seg segment) update(i int, v int, f func(int, int) int) {
	seg[0][i] = v
	for h := 1; h < len(seg); h++ {
		i >>= 1
		if i<<1+1 < len(seg[h-1]) {
			seg[h][i] = f(seg[h-1][i<<1], seg[h-1][i<<1+1])
		} else {
			seg[h][i] = seg[h-1][i<<1]
		}
	}
}
func (seg segment) query(l, r int, s int, f func(int, int) int) int {
	for h := 0; h < len(seg) && l < r; h++ {
		if l&1 == 1 {
			s = f(s, seg[h][l])
			l++
		}
		l >>= 1
		if r&1 == 1 {
			s = f(s, seg[h][r-1])
		}
		r >>= 1
	}
	return s
}
func (seg segment) add(x, y int) int {
	return x + y
}
func (seg segment) left(h, i, k int) int {
	if i < 0 {
		return -1
	}
	if seg[h][i] < k {
		k -= seg[h][i]
		i--
		if i&1 == 0 {
			return seg.left(h, i, k)
		}
		return seg.left(h+1, i>>1, k)
	}
	if h == 0 {
		return i
	}
	if k <= seg[h][i]-seg[h-1][i<<1] {
		return seg.left(h-1, i<<1+1, k)
	}
	return seg.left(h-1, i<<1, k-seg[h][i]+seg[h-1][i<<1])
}
func (seg segment) right(h, i, k int) int {
	if h >= len(seg) || i >= len(seg[h]) {
		return len(seg[0])
	}
	if seg[h][i] < k {
		k -= seg[h][i]
		i++
		if i&1 == 1 {
			return seg.right(h, i, k)
		}
		return seg.right(h+1, i>>1, k)
	}
	if h == 0 {
		return i
	}
	if k <= seg[h-1][i<<1] {
		return seg.right(h-1, i<<1, k)
	}
	return seg.right(h-1, i<<1+1, k-seg[h-1][i<<1])
}


Measured memory_bytes: 20244