#include <bits/stdc++.h>
using namespace std;
const int N = 203, INF = 1 << 20;
bool ori[N][N];
long long g[N][N];
int n, m;
double dp1[N];
double dp2[N];
void doit(int src, double *dp) {
  for (int i = (1); i <= (int)(n); i++) dp[i] = 0;
  dp[src] = 1;
  for (int d = (1); d <= (int)(n); d++) {
    for (int k = (1); k <= (int)(n); k++)
      if (g[src][k] == d) {
        for (int j = (1); j <= (int)(n); j++)
          if (g[src][j] == d - 1 && ori[k][j]) {
            dp[k] += dp[j];
          }
      }
  }
}
int main() {
  cin >> n >> m;
  for (int i = (1); i <= (int)(n); i++)
    for (int j = (1); j <= (int)(n); j++) g[i][j] = (i == j ? 0 : INF);
  memset(ori, 0, sizeof(ori));
  while (m--) {
    int first, second;
    cin >> first >> second;
    ori[first][second] = ori[second][first] = 1;
    g[first][second] = g[second][first] = 1;
  }
  for (int k = (1); k <= (int)(n); k++)
    for (int i = (1); i <= (int)(n); i++)
      for (int j = (1); j <= (int)(n); j++)
        g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
  doit(1, dp1);
  doit(n, dp2);
  double best = 0;
  double all = dp1[n];
  int sh = g[1][n];
  for (int k = (1); k <= (int)(n); k++) {
    if (g[1][k] + g[n][k] != sh) continue;
    double cur = dp1[k] * dp2[k] * (k == 1 || k == n ? 1 : 2);
    best = max(best, cur / all);
  }
  printf("%.20f\n", best);
  return 0;
}
