def dfs(v)
  return true if v == $goal
  $used[v] = true
  $g[v].each do |u, c|
    if !$used[u] && c > 0
      if dfs(u)
        $g[v][u] -= 1
        $g[u][v] += 1
        return true
      end
    end
  end
  false
end

def max_flow(size)
  flow = 0
  loop do
    $used =  [false] * size
    if dfs($start)
      flow += 1
    else
      return flow
    end
  end
end

v, e = gets.split.map(&:to_i)
$g = (v + 1).times.map { {} }
r = e.times.map{ [] }
e.times do |i|
  s, t = gets.split.map(&:to_i)
  r[i] = [s, t]
  $g[s][t] = $g[t][s] = 1
end
$start, $goal = gets.split.map(&:to_i)

p max_flow(v)

ret = r.map.with_index{ |(s, t), i| i if $g[t][s] == 0 }.compact
p ret.size
ret.each{ |i| p i + 1 }