lines = []
while line = gets
    lines << line.chomp.split(' ').map(&:to_i)
end

N = lines[0][0]
M = lines[0][1]

entree = []  #rooms which enters room i
sortie = []  #rooms one can enter from room i
for i in 1..N do
  entree[i-1] = []
  sortie[i-1] = []
end

for i in 1..M do
  from = lines[i][0]
  to = lines[i][1]
  entree[to-1].push(from)
  sortie[from-1].push(to)
end

num_entree = []
num_sortie = []
for i in 1..N do
  num_entree[i-1] = entree[i-1].length.to_f
  num_sortie[i-1] = sortie[i-1].length.to_f
end

exp_remain = []  #how many rooms on average to room N
for i in 1..N do  #initialization
  exp_remain[i-1] = 0.0
end
for i in 1..N do
  if i == 1 then
    exp_remain[-i] = 0.0
  else
    sortie[-i].each do |j|
      exp_remain[-i] += exp_remain[j-1] / num_sortie[-i]
    end
    exp_remain[-i] += 1
  end
end
  
prob_entree = []  #probality to enter the room
for i in 1..N do  #initialization
  prob_entree[i-1] = 0.0
end
for i in 1..N do
  if i == 1 then
    prob_entree[i-1] = 1.0
  else
    entree[i-1].each do |j|
      prob_entree[i-1] += prob_entree[j-1] / num_sortie[j-1]
    end
  end
end
  
exp_reduction = [] #expected reduction of rooms by blocking the room
max_exp_reduction = 0.0
blocked_path = -1
for k in 1..M do
  i = lines[k][0]  #room where the path begins (from)
  j = lines[k][1]  #room where the path ends (to)
  if sortie[i-1].length == 1 then
    exp_reduction[k-1] = -1.0  #can't block this!
  else
    temp = 1 / (num_sortie[i-1] - 1)
    after_exp_remain = (1 + temp) * exp_remain[i-1] - temp * (exp_remain[j-1] + 1)
    exp_reduction[k-1] = prob_entree[i-1] * (exp_remain[i-1] - after_exp_remain)
  end
  if exp_reduction[k-1] > max_exp_reduction then
    max_exp_reduction = exp_reduction[k-1]
  end
end
  
print exp_remain[0] - max_exp_reduction