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
	leftindex, rightindex []int
}
type node struct {
	parent   *node
	children [8]*node
	cbit     uint8
	size     int
	key      int
	value    int
	index    int
	leaf     bool
}

func newTree() *tree {
	bitsize := 30
	leftindex := make([]int, 1<<8)
	rightindex := make([]int, 1<<8)
	for i := 0; i < 1<<8; i++ {
		leftindex[i] = 0
		rightindex[i] = 7
		for j := 0; j < 8 && i>>uint(j)&1 == 0; j++ {
			leftindex[i]++
		}
		for j := 7; j >= 0 && i>>uint(j)&1 == 0; j-- {
			rightindex[i]--
		}
	}
	return &tree{bitsize: bitsize, root: newNode(0, nil), leftindex: leftindex, rightindex: rightindex}
}
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.cbit |= 1 << uint(k)
		}
		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
	d.parent.cbit ^= 1 << uint(d.index)
}
func (t *tree) left() *node {
	var parent *node
	now := t.root
	for now != nil {
		parent = now
		if t.leftindex[now.cbit] == 8 {
			now = nil
			continue
		}
		now = now.children[t.leftindex[now.cbit]]
	}
	if parent.leaf {
		return parent
	}
	return nil
}
func (t *tree) right() *node {
	var parent *node
	now := t.root
	for now != nil {
		parent = now
		if t.rightindex[now.cbit] == -1 {
			now = nil
			continue
		}
		now = now.children[t.rightindex[now.cbit]]
	}
	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: 50836