/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include "bits/stdc++.h"

#define REP(i,x,y) for(int i=(x);i<(y);i++)
#define RREP(i,x,y) for(int i=(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
//#define int long long

using namespace std;

// conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

#define dump(x)  cout << #x << " = " << (x) << endl
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

typedef long long ll;

const ll MOD = 1e9 + 7;

class FForkInTheRoad {
public:
    void solve(std::istream& in, std::ostream& out) {
        int N, M;
        in >> N >> M;
        vector<int> s(M), t(M);
        REP(i,0,M) in >> s[i] >> t[i];

        vector<vector<int>> st(N+1), ts(N+1);
        REP(i,0,M) {
            st[s[i]].push_back(t[i]);
            ts[t[i]].push_back(s[i]);
        }

        vector<double> mean(N);
        auto calculateMeanDistanceToN = [&](int start, pair<int, int> shouldBeClosed = {-1, -1}) -> double {
            vector<double> probs(N+1,0), means(N+1,0);
            probs[start] = 1;
            REP(current,start,N) {
                int size = st[current].size();
                if (current == shouldBeClosed.first) size--;
                for (const auto next : st[current]) {
                    if (current == shouldBeClosed.first && next == shouldBeClosed.second) continue;
                    probs[next] += probs[current] / size;
                }
            }
            means[start] = 0;
            REP(current,start+1,N+1) {
                double ratioSum = 0;
                for (const auto from : ts[current]) {
                    int size = st[from].size();
                    if (from == shouldBeClosed.first) size--;
                    if (current == shouldBeClosed.second && from == shouldBeClosed.first) continue;
                    means[current] += (means[from] + 1) * (probs[from] / size);
                    ratioSum += probs[from] / size;
                }
                if (ratioSum != 0) means[current] /= ratioSum;
            }

//            REP(i,1,N+1) {
//                debug(i);
//                debug(probs[i]);
//                debug(means[i]);
//            }
            return means[N];
        };
        REP(start,1,N) {
            mean[start] = calculateMeanDistanceToN(start);
        }

        auto findShouldBeClosedCandidates = [&]() -> vector<pair<int, int>> {
            vector<double> probs(N+1,0);
            probs[1] = 1;
            REP(current,1,N) {
                for (const auto next : st[current]) {
                    probs[next] += probs[current] / st[current].size();
                }
            }
            vector<pair<int, int>> shouldBeClosedCandidates = {{-1, -1}}; // aisle to be closed
            REP(current,1,N) {
                if (st[current].size() == 1) continue;
                double maxMean = 0;
                pair<int, int> candidate;
                for (const auto next : st[current]) {
                    if (mean[next] > maxMean) {
                        candidate = {current, next};
                        maxMean = mean[next];
                    }
                }
                shouldBeClosedCandidates.push_back(candidate);
            }
            return shouldBeClosedCandidates;
        };


        vector<pair<int, int>> shouldBeClosedCandidates = findShouldBeClosedCandidates();
        double answer = 1e5;
        for (const auto& shouldBeClosed : shouldBeClosedCandidates) {
            answer = min(calculateMeanDistanceToN(1, shouldBeClosed), answer);
        }

//        out << shouldBeClosed.first << shouldBeClosed.second << "\n";
        out << fixed << setprecision(10) << answer << "\n";
    }
};


int main() {
	FForkInTheRoad solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3968