#include <bits/stdc++.h>
using namespace std;
const int MOD(1000000007);
const int INF((1 << 30) - 1);
const int MAXN(105);
int a[MAXN][MAXN];
long long num[MAXN][MAXN];
void FWS(int n) {
  for (int k = 1; k <= n; k++)
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= n; j++)
        if (a[i][k] + a[k][j] < a[i][j]) {
          a[i][j] = a[i][k] + a[k][j];
          num[i][j] = (num[i][k] * num[k][j]);
        } else if (a[i][k] + a[k][j] == a[i][j])
          num[i][j] += (num[i][k] * num[k][j]);
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) {
      if (i == j)
        a[i][j] = 0;
      else
        a[i][j] = INF;
      num[i][j] = 0;
    }
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    a[u][v] = a[v][u] = 1;
    num[u][v] = num[v][u] = 1;
  }
  FWS(n);
  double ans = 1.0;
  for (int i = 2; i <= n - 1; i++)
    if (a[1][i] + a[i][n] == a[1][n])
      ans = max(ans, (double)(2 * num[1][i] * num[i][n]) / (double)(num[1][n]));
  printf("%.10lf", ans);
}
