#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse4,avx,avx2,fma")
using namespace std;
const char nl = '\n';
using ll = long long;
using vi = vector<long long>;
using vl = vector<ll>;
using pii = pair<long long, long long>;
using pll = pair<ll, ll>;
using str = string;
using vpii = vector<pii>;
using vpll = vector<pll>;
template <class T>
inline bool ckmin(T& a, T b) {
  return b < a ? a = b, 1 : 0;
}
template <class T>
inline bool ckmax(T& a, T b) {
  return b > a ? a = b, 1 : 0;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
str to_string(char c) { return str(1, c); }
str to_string(bool b) { return b ? "true" : "false"; }
str to_string(const char* second) { return (str)second; }
str to_string(str second) { return second; }
template <class A>
str to_string(complex<A> c) {
  stringstream ss;
  ss << c;
  return ss.str();
}
str to_string(vector<bool> v) {
  str res = "{";
  for (long long i = 0; i < (long long)v.size(); i++) res += char('0' + v[i]);
  res += "}";
  return res;
}
template <size_t SZ>
str to_string(bitset<SZ> b) {
  str res = "";
  for (long long i = 0; i < b.size(); i++) res += char('0' + b[i]);
  return res;
}
template <class A, class B>
str to_string(pair<A, B> p);
template <class T>
str to_string(T v) {
  bool fst = 1;
  str res = "{";
  for (const auto& x : v) {
    if (!fst) res += ", ";
    fst = 0;
    res += to_string(x);
  }
  res += "}";
  return res;
}
template <class A, class B>
str to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
void DBG() { cerr << "]" << endl; }
template <class H, class... T>
void DBG(H h, T... t) {
  cerr << to_string(h);
  if (sizeof...(t)) cerr << ", ";
  DBG(t...);
}
const long long mxN = 101;
long long n, m, d[mxN], ways[mxN], vis[mxN], out[mxN], in[mxN], ways2[mxN],
    d2[mxN];
vi adj[mxN];
queue<long long> q;
queue<pii> q2;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  for (long long i = 0; i < m; i++) {
    long long a, b;
    cin >> a >> b;
    a--;
    b--;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  memset(d, -1, sizeof(d));
  d[0] = 0;
  ways[0] = 1;
  q.push(0);
  while (!q.empty()) {
    long long u = q.front();
    q.pop();
    for (auto& v : adj[u])
      if (d[v] == -1) {
        q.push(v);
        d[v] = d[u] + 1;
        ways[v] += ways[u];
      } else if (d[v] == d[u] + 1) {
        ways[v] += ways[u];
      }
  }
  memset(d2, -1, sizeof(d2));
  d2[n - 1] = 0;
  ways2[n - 1] = 1;
  q.push(n - 1);
  while (!q.empty()) {
    long long u = q.front();
    q.pop();
    for (auto& v : adj[u])
      if (d2[v] == -1) {
        q.push(v);
        ways2[v] += ways2[u];
        d2[v] = d2[u] + 1;
      } else if (d2[u] + 1 == d2[v]) {
        ways2[v] += ways2[u];
      }
  }
  ll ans = 0;
  for (long long i = 0; i < n; i++) {
    cerr << d[i] << " " << d2[i] << nl;
    if (d[i] + d2[i] == d[n - 1]) {
      if (i != 0 && i != n - 1)
        ckmax(ans, (ll)ways[i] * ways2[i] * 2);
      else
        ckmax(ans, (ll)ways[i] * ways2[i]);
    }
  }
  cout << fixed << setprecision(12) << (double)ans / ways[n - 1] << nl;
}
