n,m=gets.split.map(&:to_i)
hash = Hash.new(0)
m.times do
  a,b = gets.split.map(&:to_i)
  hash[a]=[hash[a],b].max
end
#p hash
if hash[1]==0
  puts "Impossible"

else
  i=1
 c =0
  loop do
   # puts i
    if hash[i]==n
      c+=1
      break
    end
    hash[i].downto(i+1) do |j|
      if hash[j]!=0
        i=j
        c+=1
        break
      elsif j==i+1
        puts "Impossible"
        exit
      end
    end
  end
  puts c
end