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 {
	parent   *node
	children [8]*node
	size     int
	key      int
	value    int
	index    int
	leaf     bool
}

func newTree() *tree {
	bitsize := 30
	return &tree{bitsize: bitsize, root: newNode(0, nil)}
}
func newNode(index int, parent *node) *node {
	return &node{index: index, parent: parent}
}
func (t *tree) put(key int, x int) {
	now := t.root
	for i := t.bitsize - 3; i >= 0; i -= 3 {
		k := key >> uint(i) & 7
		if now.children[k] == nil {
			now.children[k] = newNode(k, now)
		}
		now = now.children[k]
	}
	dx := 1 - now.size
	now.key = key
	now.value = x
	now.leaf = true
	for now != nil {
		now.size += dx
		now = now.parent
	}
}
func (t *tree) nodesize(now *node) int {
	if now == nil {
		return 0
	}
	return now.size
}
func (t *tree) get(key int) (int, bool) {
	now := t.root
	for i := t.bitsize - 3; i >= 0 && t.exists(now); i -= 3 {
		now = now.children[key>>uint(i)&7]
	}
	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 - 3; i >= 0 && t.exists(now); i -= 3 {
		now = now.children[key>>uint(i)&7]
	}
	d := now
	for now != nil {
		now.size--
		if now.size == 0 {
			d = now
		}
		now = now.parent
	}
	if d == t.root {
		for i := 0; i < 8; i++ {
			d.children[i] = nil
		}
		return
	}
	d.parent.children[d.index] = nil
}
func (t *tree) left() *node {
	var parent *node
	now := t.root
	for now != nil {
		parent = now
		child := now.children[0]
		for i := 1; i < 8 && child == nil; i++ {
			child = now.children[i]
		}
		now = child
	}
	if parent.leaf {
		return parent
	}
	return nil
}
func (t *tree) right() *node {
	var parent *node
	now := t.root
	for now != nil {
		parent = now
		child := now.children[7]
		for i := 6; i >= 0 && child == nil; i-- {
			child = now.children[i]
		}
		now = child
	}
	if parent.leaf {
		return parent
	}
	return nil
}
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 - 3; i >= 0 && now != nil; i -= 3 {
		k := key >> uint(i) & 7
		for j := 0; j < k; j++ {
			cnt += t.nodesize(now.children[j])
		}
		now = now.children[k]
	}
	return cnt
}
func (t *tree) nthNode(index int) *node {
	now := t.root
	var parent *node
	for now != nil && index > 0 {
		parent = now
		for i := 0; i < 8; i++ {
			if index > t.nodesize(now.children[i]) {
				index -= t.nodesize(now.children[i])
				continue
			}
			now = now.children[i]
			break
		}
		if now == parent {
			break
		}
	}
	if parent == nil || !parent.leaf {
		return nil
	}
	return parent
}


Measured memory_bytes: 46656