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
c=0
if hash[1]==0
  puts "Impossible"
else
  i=1
  ni=1
  loop do
    if hash[i]==n
      c+=1
      puts c
      break
    elsif hash[i]==i
      c+=1
      i+=1
      next
    end
    dis = hash[i]
    (i+1..dis).each do |j|
      if hash[j]<=dis
        next
      else
        ni=j
      end
    end
    if (ni==i)
      puts "Impossible"
      break
    end
    i=ni
    c+=1
  end
end