#include <bits/stdc++.h>
using namespace std;
double f[2][110];
int dp[2][110];
vector<int> v[110];
void bfs(int u, int id) {
  queue<int> q;
  memset(f[id], 0, sizeof(f[id]));
  memset(dp[id], -1, sizeof(dp[id]));
  q.push(u);
  f[id][u] = 1;
  dp[id][u] = 0;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = 0; i < v[u].size(); i++)
      if (dp[id][v[u][i]] == -1) {
        dp[id][v[u][i]] = dp[id][u] + 1;
        f[id][v[u][i]] += f[id][u];
        q.push(v[u][i]);
      } else if (dp[id][v[u][i]] == dp[id][u] + 1) {
        f[id][v[u][i]] += f[id][u];
      }
  }
}
int main() {
  int n, m, x, y;
  scanf("%d%d", &n, &m);
  while (m--) {
    scanf("%d%d", &x, &y);
    v[x].push_back(y);
    v[y].push_back(x);
  }
  bfs(1, 0);
  bfs(n, 1);
  double ans = 0;
  for (int i = 1; i <= n; i++) {
    double sum = 0;
    for (int j = 0; j < v[i].size(); j++) {
      int x = i, y = v[i][j];
      if (dp[0][x] + dp[1][y] + 1 == dp[0][n]) {
        sum += f[0][x] * f[1][y];
      } else if (dp[0][y] + dp[1][x] + 1 == dp[0][n]) {
        sum += f[0][y] * f[1][x];
      }
    }
    if (sum / f[0][n] > ans) ans = sum / f[0][n];
  }
  printf("%.20lf\n", ans);
  return 0;
}
