#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8, pi = acos(-1.0);
int cl(double z) { return ceil(z - eps); }
int flr(double z) { return floor(z + eps); }
long long cll(double z) { return ceil(z - eps); }
long long flrl(double z) { return floor(z + eps); }
int dblcmp(double d) { return (d < -eps) ? -1 : (d > eps); }
const int inf = 999999999;
const long long infl = 999999999999999999LL;
template <class T>
inline void checkmin(T &a, T b) {
  if (a > b) a = b;
}
template <class T>
inline void checkmax(T &a, T b) {
  if (a < b) a = b;
}
template <class T>
inline bool fcheckmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  } else
    return false;
}
template <class T>
inline bool fcheckmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  } else
    return false;
}
template <class T>
inline double dist(T a, T b) {
  return sqrt(a * 1.0 * a + b * 1.0 * b);
}
inline int pinput() {
  int S = 0, c = getchar();
  while (!isdigit(c)) c = getchar();
  while (isdigit(c)) {
    S = S * 10 + c - 48;
    c = getchar();
  }
  return S;
}
char buf[1000005];
int g[105][105];
int v[105];
int q[105], qs[105];
double dp1[105];
double dp2[105];
bool inq[105];
void f(int src, int delta, double *dp, int n) {
  memset(inq, false, sizeof(inq));
  q[0] = src;
  inq[0] = true;
  for (int i = (1); i <= (n); i++) dp[i] = 0.0;
  dp[src] = 1.0;
  int qb = 0, qe = 0;
  while (qb <= qe) {
    int h = q[qb++];
    for (int i = (1); i <= (n); i++)
      if (g[h][i] && v[i] - v[h] == delta) {
        dp[i] += dp[h];
        if (!inq[i]) {
          q[++qe] = i;
          inq[i] = true;
        }
      }
  }
}
void solve() {
  int n, m, a, b;
  scanf("%d%d", &n, &m);
  while (m--) {
    scanf("%d%d", &a, &b);
    g[a][b] = g[b][a] = 1;
  }
  for (int i = (1); i <= (n); i++) v[i] = inf;
  v[1] = 0;
  int qb = 0, qe = 0;
  q[0] = 1;
  qs[0] = 0;
  while (qb <= qe) {
    int h = q[qb];
    int s = qs[qb++];
    for (int i = (1); i <= (n); i++)
      if (v[i] > 999999 && g[h][i]) {
        v[i] = s + 1;
        q[++qe] = i;
        qs[qe] = s + 1;
      }
  }
  f(1, 1, dp1, n);
  f(n, -1, dp2, n);
  double DOWN = dp1[n];
  double ans = DOWN;
  for (int i = (2); i <= (n - 1); i++) {
    checkmax(ans, 2 * dp1[i] * dp2[i]);
  }
  printf("%.18f\n", ans / DOWN);
}
int main() {
  do {
    solve();
  } while (0);
}
