#include <bits/stdc++.h>
using namespace std;
const long long N = 105;
bool g[N][N];
long long n, m, len, cnt, ans;
long long dis[N], ps[N], ns[N];
bool vis[N];
struct dat {
  long long d, x;
  dat(long long _d, long long _x) : d(_d), x(_x) {}
};
void bfs() {
  queue<dat> Q;
  Q.push(dat(0, 1));
  memset(dis, 0x7f, sizeof(dis));
  dis[1] = 0;
  ps[1] = 1;
  while (!Q.empty()) {
    dat u = Q.front();
    Q.pop();
    if (u.x == n) {
      len = dis[u.x];
      cnt = ps[u.x];
      return;
    }
    for (long long v = 1; v <= n; v++)
      if (g[u.x][v] && dis[v] == 0x7f7f7f7f7f7f7f7f) {
        Q.push(dat(u.d + 1, v));
        dis[v] = u.d + 1;
        for (long long vv = 1; vv <= n; vv++)
          if (g[v][vv] && dis[vv] + 1 == dis[v]) ps[v] += ps[vv];
      }
  }
  return;
}
void bfs1() {
  queue<long long> Q;
  Q.push(n);
  vis[n] = 1;
  ns[n] = 1;
  while (!Q.empty()) {
    long long u = Q.front();
    Q.pop();
    ans = max(((u == 1 || u == n) ? 1ll : 2ll) * ps[u] * ns[u], ans);
    for (long long v = 1; v <= n; v++)
      if (g[u][v] && !vis[v] && dis[v] + 1 == dis[u]) {
        vis[v] = 1;
        for (long long vv = 1; vv <= n; vv++)
          if (g[v][vv] && vis[vv]) ns[v] += ns[vv];
        Q.push(v);
      }
  }
}
int main() {
  scanf("%lld%lld", &n, &m);
  for (long long i = 1; i <= m; i++) {
    long long x, y;
    scanf("%lld%lld", &x, &y);
    g[x][y] = g[y][x] = 1;
  }
  bfs();
  bfs1();
  printf("%.7lf\n", (double)ans / (double)(cnt));
}
