package main

import (
	"bufio"
	"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)
	cell := newTree()
	distance := newTree()
	for i := 0; i < w; i++ {
		cell.put(i, i)
	}
	distance.put(0, w)
	for i := 0; i < h; i++ {
		a := getNextInt(scanner) - 1
		b := getNextInt(scanner)
		x := -1
		for nd := cell.ceiling(a); nd != nil && nd.key <= b; nd = cell.ceiling(a) {
			if x < nd.value {
				x = nd.value
			}
			distance.decrement(nd.key - nd.value)
			cell.remove(nd.key)
		}
		if b < w && x != -1 {
			old, found := cell.get(b)
			if found {
				x = max(old, x)
			}
			cell.put(b, x)
			distance.increment(b - x)
		}
		if distance.empty() {
			fmt.Fprintln(writer, -1)
			continue
		}
		fmt.Fprintln(writer, distance.left().key+i+1)
	}
}
func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

type tree struct {
	root    *node
	bitsize int
}
type node struct {
	left, right, parent *node
	size                int
	key                 int
	value               int
	leaf                bool
}

func newTree() *tree {
	bitsize := 20
	return &tree{bitsize: bitsize, root: newNode(nil)}
}
func newNode(parent *node) *node {
	return &node{size: 0, value: 0, parent: parent}
}
func (t *tree) put(key int, x int) {
	now := t.root
	for i := t.bitsize - 1; i >= 0; i-- {
		if key>>uint(i)&1 == 0 {
			if now.left == nil {
				now.left = newNode(now)
			}
			now = now.left
			continue
		}
		if now.right == nil {
			now.right = newNode(now)
		}
		now = now.right
	}
	now.size = 1
	now.key = key
	now.value = x
	now.leaf = true
	t.updatesize(now)
}
func (t *tree) nodesize(now *node) int {
	if now == nil {
		return 0
	}
	return now.size
}
func (t *tree) updatesize(now *node) {
	for now.parent != nil {
		now.parent.size = t.nodesize(now.parent.left) + t.nodesize(now.parent.right)
		now = now.parent
	}
}
func (t *tree) get(key int) (int, bool) {
	now := t.root
	for i := t.bitsize - 1; i >= 0 && t.exists(now); i-- {
		if key>>uint(i)&1 == 0 {
			now = now.left
			continue
		}
		now = now.right
	}
	if t.exists(now) {
		return now.value, true
	}
	return 0, false
}
func (t *tree) remove(key int) {
	_, found := t.get(key)
	if !found {
		return
	}
	now := t.root
	for i := t.bitsize - 1; i >= 0; i-- {
		if key>>uint(i)&1 == 0 {
			now = now.left
			continue
		}
		now = now.right
	}
	d := now
	for now != nil {
		now.size--
		if now.size == 0 {
			d = now
		}
		now = now.parent
	}
	if d == t.root {
		t.root.left = nil
		t.root.right = nil
		return
	}
	if d == d.parent.left {
		d.parent.left = nil
		return
	}
	d.parent.right = nil
}
func (t *tree) down(now *node, lower func(*node) bool) *node {
	if now == nil {
		return nil
	}
	var parent *node
	for now != nil {
		parent = now
		if lower(now) {
			now = now.left
			continue
		}
		now = now.right
	}
	if parent.leaf {
		return parent
	}
	return nil
}
func (t *tree) left() *node {
	return t.down(t.root, func(now *node) bool { return t.exists(now.left) })
}
func (t *tree) right() *node {
	return t.down(t.root, func(now *node) bool { return !t.exists(now.right) })
}
func (t *tree) floor(key int) *node {
	return t.nthNode(t.lowercount(key + 1))
}
func (t *tree) ceiling(key int) *node {
	return t.nthNode(t.lowercount(key) + 1)
}
func (t *tree) empty() bool {
	return t.root.size == 0
}
func (t *tree) exists(now *node) bool {
	return now != nil && now.size > 0
}
func (t *tree) increment(key int) {
	x, found := t.get(key)
	if found {
		t.put(key, x+1)
		return
	}
	t.put(key, 1)
}
func (t *tree) decrement(key int) {
	x, found := t.get(key)
	if !found {
		return
	}
	x--
	if x == 0 {
		t.remove(key)
		return
	}
	t.put(key, x)
}
func (t *tree) lowercount(key int) int {
	var cnt int
	now := t.root
	for i := t.bitsize - 1; i >= 0 && now != nil; i-- {
		if key>>uint(i)&1 == 0 {
			now = now.left
			continue
		}
		if now.left != nil {
			cnt += now.left.size
		}
		now = now.right
	}
	return cnt
}
func (t *tree) nthNode(index int) *node {
	now := t.root
	var parent *node
	for now != nil && index > 0 {
		parent = now
		if index > t.nodesize(now.left) {
			index -= t.nodesize(now.left)
			now = now.right
			continue
		}
		now = now.left
	}
	if parent == nil || !parent.leaf {
		return nil
	}
	return parent
}


Measured memory_bytes: 49340