#include <bits/stdc++.h>
using namespace std;
const int maxn = 110;
const int oo = 10000000;
bool a[maxn][maxn];
int f[maxn][maxn], n, m;
long long d[maxn][maxn];
long long res;
int main() {
  memset(a, false, sizeof(a));
  int u, v;
  cin >> n >> m;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) f[i][j] = oo;
  memset(d, 0, sizeof(d));
  for (int i = 1; i <= m; i++) {
    cin >> u >> v;
    d[u][v] = 1;
    d[v][u] = 1;
    f[u][v] = 1;
    f[v][u] = 1;
  }
  res = 0;
  for (int k = 1; k <= n; k++)
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= n; j++) {
        if (f[i][j] > f[i][k] + f[k][j]) {
          f[i][j] = f[i][k] + f[k][j];
          d[i][j] = d[i][k] * d[k][j];
        } else if (f[i][j] == (f[i][k] + f[k][j]))
          d[i][j] += (d[i][k] * d[k][j]);
      }
  res = d[1][n];
  for (int i = 2; i <= n - 1; i++)
    if (f[1][n] == (f[1][i] + f[i][n])) {
      if (res < (d[1][i] * d[i][n] * 2)) res = d[1][i] * d[i][n] * 2;
    }
  printf("%0.8f", (float)res / d[1][n]);
}
