#include <bits/stdc++.h>
using namespace std;
long long n, m, i, j, k, x, y, wt, d;
long long dp[110][110], g[110][110], from1[110], fromN[110], weight[110];
int main() {
  wt = -1;
  cin >> n >> m;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      dp[i][j] = 100000000LL;
      if (i == j) dp[i][j] = 0;
    }
  }
  for (i = 1; i <= m; i++) {
    cin >> x >> y;
    g[x][y] = 1;
    g[y][x] = 1;
    dp[x][y] = 1;
    dp[y][x] = 1;
  }
  for (k = 1; k <= n; k++) {
    for (i = 1; i <= n; i++) {
      for (j = 1; j <= n; j++) {
        dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
      }
    }
  }
  memset(from1, 0, sizeof(from1));
  memset(fromN, 0, sizeof(fromN));
  memset(weight, 0, sizeof(weight));
  from1[1] = 1;
  fromN[n] = 1;
  for (d = 1; d <= n; d++) {
    for (i = 1; i <= n; i++) {
      if (dp[1][i] == d) {
        for (j = 1; j <= n; j++) {
          if (dp[1][j] == d - 1 && dp[j][i] == 1) {
            from1[i] += from1[j];
          }
        }
      }
    }
    for (i = 1; i <= n; i++) {
      if (dp[n][i] == d) {
        for (j = 1; j <= n; j++) {
          if (dp[n][j] == d - 1 && dp[j][i] == 1) {
            fromN[i] += fromN[j];
          }
        }
      }
    }
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      if (dp[1][i] + 1 + dp[j][n] == dp[1][n] && dp[i][j] == 1) {
        weight[i] += from1[i] * fromN[j];
        weight[j] += from1[i] * fromN[j];
      }
    }
  }
  double maxweight = 0;
  for (i = 1; i <= n; i++) {
    maxweight = max(maxweight, (double)weight[i]);
  }
  cout << setprecision(18) << maxweight / from1[n];
  return 0;
}
