require 'matrix'
$n, m, *steps = gets.split.map(&:to_i)

reachable = [nil]
mat = (0..$n).map { (0..$n).map { 0 } }
m.times do
    i, j = gets.split.map(&:to_i)
    mat[i][j] = 1
end
mat = Matrix[*mat]
reachable << mat

steps.max.times do
    reachable << reachable[1] * reachable[-1]
end

$trans = steps.map do |k|
    (0..$n).map {|u| (0..$n).select {|v| reachable[k][u, v] == 1}}
end

require 'set'
visited = Set.new

def max_min(u, visited, alpha, beta)
    return beta if visited.include?(u)
    return beta if visited.size >= beta
    return visited.size if u == $n
    s = visited.dup
    s << u
    $trans.each do |t|
        x = min_max(u, t, s, alpha, beta)
        if x > alpha
            alpha = x
            return beta if alpha >= beta
        end
    end
    alpha
end

def min_max(u, t, visited, alpha, beta)
    t[u].each do |v|
        x = max_min(v, visited, alpha, beta)
        if x < beta
            beta = x
            return alpha if alpha >= beta
        end
    end
    beta
end

d = max_min(1, Set.new, 0, Float::INFINITY)
puts d == Float::INFINITY ? 'IMPOSSIBLE' : d