#include <bits/stdc++.h>
struct edge {
  int f, t;
  edge() {}
  edge(int f, int t) : f(f), t(t) {}
} e[10101];
struct vedge {
  int t, i;
  vedge(int t, int i) : t(t), i(i) {}
};
std::vector<vedge> ve[101];
int dist[101][101];
long long dp[101][3];
bool use[10101];
bool safe[10101];
void bfs(int root) {
  std::queue<int> que;
  que.push(root);
  dist[root][root] = 0;
  while (!que.empty()) {
    int t = que.front();
    que.pop();
    for (size_t i = 0; i < ve[t].size(); ++i) {
      vedge& v = ve[t][i];
      if (dist[root][v.t] == -1) {
        dist[root][v.t] = dist[root][t] + 1;
        que.push(v.t);
      }
    }
  }
}
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  int u, v;
  for (int i = 1; i <= m; ++i) {
    scanf("%d %d", &u, &v);
    e[i] = edge(u, v);
    ve[u].push_back(vedge(v, i));
    ve[v].push_back(vedge(u, i));
  }
  memset(dist, -1, sizeof(dist));
  bfs(1);
  bfs(n);
  int sh = dist[1][n];
  double ans = 0;
  for (int p = 1; p <= n; ++p) {
    for (int i = 1; i <= m; ++i)
      use[i] = (dist[1][e[i].f] + dist[n][e[i].t] == sh - 1) ||
               (dist[1][e[i].t] + dist[n][e[i].f] == sh - 1);
    memset(dp, 0, sizeof(dp));
    memset(safe, 0, sizeof(safe));
    for (size_t i = 0; i < ve[p].size(); ++i) safe[ve[p][i].i] = true;
    std::queue<int> que;
    que.push(1);
    dp[1][0] = 1;
    while (!que.empty()) {
      int t = que.front();
      que.pop();
      for (size_t i = 0; i < ve[t].size(); ++i) {
        vedge& v = ve[t][i];
        if (use[v.i]) {
          use[v.i] = false;
          if (safe[v.i]) {
            dp[v.t][1] += dp[t][0];
            dp[v.t][2] += dp[t][1];
          } else {
            dp[v.t][0] += dp[t][0];
            dp[v.t][1] += dp[t][1];
            dp[v.t][2] += dp[t][2];
          }
          que.push(v.t);
        }
      }
    }
    long long ts = dp[n][1] + (dp[n][2] << 1);
    long long ms = dp[n][0] + dp[n][1] + dp[n][2];
    double val = 1.f * ts / ms;
    if (val > ans) ans = val;
  }
  printf("%.16lf", ans);
}
