#include <bits/stdc++.h>
using namespace std;
long long mat[128][128];
long long dp1[128][128];
long long dp2[128][128];
long long n, m;
long long mx, minDis;
long long f1(long long u, long long d) {
  if (u == 1 && d == 0) return 1;
  if (u == 1 || d < 0) return 0;
  long long &ref = dp1[u][d];
  if (ref != -1) return ref;
  ref = 0;
  for (long long j = 1; j <= n; j++)
    if (mat[j][u] == 1) ref += f1(j, d - 1);
  return ref;
}
long long f2(long long u, long long d) {
  if (u == n && d == 0) return 1;
  if (u == n || d < 0) return 0;
  long long &ref = dp2[u][d];
  if (ref != -1) return ref;
  ref = 0;
  for (long long j = 1; j <= n; j++)
    if (mat[j][u] == 1) ref += f2(j, d - 1);
  return ref;
}
int main() {
  while (cin >> n >> m) {
    for (long long i = 1; i <= n; i++)
      for (long long j = 1; j <= n; j++) mat[i][j] = 100000000;
    while (m--) {
      long long x, y;
      cin >> x >> y;
      mat[x][y] = mat[y][x] = 1;
    }
    memset(dp1, -1, sizeof dp1);
    memset(dp2, -1, sizeof dp2);
    dp1[1][0] = 1;
    dp2[n][0] = 1;
    minDis = 100;
    for (long long i = 1; i <= n; i++) {
      long long tmp = f1(n, i);
      if (tmp != 0) {
        minDis = i;
        break;
      }
    }
    long long all = f2(1, minDis);
    mx = all;
    for (long long k = 1; k <= n; k++)
      for (long long i = 1; i <= n; i++)
        for (long long j = 1; j <= n; j++)
          if (j != k && j != i && i != k)
            mat[i][j] = min(mat[i][j], mat[i][k] + mat[k][j]);
    for (long long i = 2; i < n; i++) {
      if (mat[1][i] + mat[i][n] == mat[1][n]) {
        long long tmp = dp1[i][mat[1][i]] * dp2[i][mat[i][n]] * 2;
        mx = max(mx, tmp);
      }
    }
    printf("%.10lf\n", mx * 1.0 / all);
  }
  return 0;
}
