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)
	bt := newBitree(w)
	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
		bt.add(i, 1)
	}
	p := &pp
	heap.Init(p)
	for i := 0; i < h; i++ {
		a := getNextInt(scanner) - 1
		b := getNextInt(scanner)
		v := -1
		for a < b {
			a = bt.right(a)
			if a < b {
				bt.add(a, -1)
				if v < pp[index[a]][1] {
					v = pp[index[a]][1]
				}
				heap.Remove(p, index[a])
			}
		}
		if b < w && v != -1 {
			if index[b] != -1 {
				if v < pp[index[b]][1] {
					v = pp[index[b]][1]
				}
				bt.add(b, -1)
				heap.Remove(p, index[b])
			}
			heap.Push(p, pair{b, v})
			bt.add(b, 1)
		}
		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 bitree []int

func newBitree(n int) bitree {
	return make(bitree, n+1)
}
func (b *bitree) add(i int, x int) {
	n := len(*b)
	for i++; i < n; i += i & -i {
		(*b)[i] += x
	}
}
func (b *bitree) sum(i int) int {
	var x int
	for ; i > 0; i -= i & -i {
		x += (*b)[i]
	}
	return x
}
func (b *bitree) lowerbound(x int) int {
	if x == 0 {
		return -1
	}
	k := 1
	n := len(*b)
	for i := n; i > 1; i >>= 1 {
		k <<= 1
	}
	for k&1 == 0 {
		if k < n && (*b)[k] < x {
			x -= (*b)[k]
			k += (k & -k) >> 1
			continue
		}
		k -= (k & -k) >> 1
	}
	if k < n && (*b)[k] < x {
		return k
	}
	return k - 1
}
func (b *bitree) left(i int) int {
	return b.lowerbound(b.sum(i))
}
func (b *bitree) right(i int) int {
	return b.lowerbound(b.sum(i) + 1)
}


Measured memory_bytes: 16384