#include <bits/stdc++.h>
using namespace std;
int n, m;
int mat[110][110];
long long num1[110];
long long numn[110];
int main() {
  scanf("%d%d", &n, &m);
  memset(mat, 1, sizeof(mat));
  for (int i = 0; i < m; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    mat[a][b] = mat[b][a] = 1;
  }
  for (int i = 1; i <= n; ++i) mat[i][i] = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      for (int k = 1; k <= n; ++k) {
        mat[j][k] = min(mat[j][i] + mat[i][k], mat[j][k]);
      }
    }
  }
  num1[1] = 1;
  for (int t = 1; t <= n; ++t) {
    for (int i = 1; i <= n; ++i) {
      if (mat[1][i] != t) continue;
      for (int j = 1; j <= n; ++j) {
        if (mat[1][j] == t - 1 && mat[i][j] == 1) num1[i] += num1[j];
      }
    }
  }
  numn[n] = 1;
  for (int t = 1; t <= n; ++t) {
    for (int i = 1; i <= n; ++i) {
      if (mat[n][i] != t) continue;
      for (int j = 1; j <= n; ++j) {
        if (mat[n][j] == t - 1 && mat[i][j] == 1) numn[i] += numn[j];
      }
    }
  }
  long long temp = numn[1];
  for (int i = 2; i < n; ++i) {
    if (mat[i][1] + mat[i][n] == mat[1][n])
      temp = max(temp, 2LL * num1[i] * numn[i]);
  }
  double ans = temp;
  printf("%.9f\n", ans / num1[n]);
  return 0;
}
