N, M = gets.split.map(&:to_i)

a = []
M.times {
	a << gets.split.map(&:to_i)
}
a.sort!
	
i = 1
c = 0
loop {
	c += 1
	max = -1
	while !a.empty? && a[0][0] <= i
		max = [max, a.shift[1]].max
	end

	if max < 0
		puts 'Impossible'
		break
	end

	if max == N
		puts c
		break
	end

	i = max + 1
}