#include <bits/stdc++.h>
using namespace std;
template <typename T>
using V = vector<T>;
const int INF = 1e9 + 5;
const int MOD = (int)1e9 + 7;
const int maxn = 1e2 + 5;
const int maxm = 1e6 + 5;
int modE(int n, int x) {
  int res = 1;
  while (x) {
    if (x & 1) res = (1ll * res * n) % MOD;
    n = (1ll * n * n) % MOD;
    x >>= 1;
  }
  return res;
}
long long int n, m, u, v, d[maxn][2], dr[maxn][2];
V<int> G[maxn];
queue<int> q;
void bfs() {
  q.push(1);
  d[1][0] = 0, d[1][1] = 1;
  while (!q.empty()) {
    int v = q.front();
    q.pop();
    if (v == n) continue;
    for (auto u : G[v]) {
      if (d[u][0] == INF) q.push(u);
      if (d[u][0] == d[v][0] + 1 || d[u][0] == INF) {
        d[u][0] = d[v][0] + 1;
        d[u][1] += d[v][1];
      }
    }
  }
  q.push(n);
  dr[n][0] = 0, dr[n][1] = 1;
  while (!q.empty()) {
    int v = q.front();
    q.pop();
    if (v == 1) continue;
    for (auto u : G[v]) {
      if (dr[u][0] == INF) q.push(u);
      if (dr[u][0] == dr[v][0] + 1 || dr[u][0] == INF) {
        dr[u][0] = dr[v][0] + 1;
        dr[u][1] += dr[v][1];
      }
    }
  }
}
int main() {
  for (int i = 0; i < (int)(maxn); ++i)
    d[i][0] = INF, d[i][1] = 0, dr[i][0] = INF, dr[i][1] = 0;
  cin >> n >> m;
  for (int i = 1; i <= (int)(m); ++i) {
    cin >> u >> v;
    G[u].push_back(v), G[v].push_back(u);
  }
  bfs();
  long long int ans = 0, tot = 0;
  for (int i = 1; i <= (int)(n); ++i)
    if (d[i][0] + dr[i][0] == d[n][0]) {
      if (ans < d[i][1] * dr[i][1] * (i == 1 || i == n ? 1 : 2)) {
        ans = d[i][1] * dr[i][1] * (i == 1 || i == n ? 1 : 2);
      }
    }
  tot = d[n][1];
  printf("%.8f\n", (double)ans / tot);
}
