#include <bits/stdc++.h>
const int oo = 0x3f3f3f3f;
template <typename T>
inline bool chkmax(T &a, T b) {
  return a < b ? a = b, true : false;
}
template <typename T>
inline bool chkmin(T &a, T b) {
  return a > b ? a = b, true : false;
}
const int MAXN = 105;
int N, M;
int G[MAXN][MAXN];
int dis[MAXN][MAXN];
long long fs[MAXN];
long long ft[MAXN];
long long countfs(int u) {
  if (fs[u] != -1) return fs[u];
  long long &ret = fs[u] = 0;
  for (int v = 1; v <= N; ++v) {
    if (G[u][v] == 1 && dis[1][u] + 1 == dis[1][v]) ret += countfs(v);
  }
  return ret;
}
long long countft(int u) {
  if (ft[u] != -1) return ft[u];
  long long &ret = ft[u] = 0;
  for (int v = 1; v <= N; ++v) {
    if (G[v][u] == 1 && dis[1][v] + 1 == dis[1][u]) ret += countft(v);
  }
  return ret;
}
void input() {
  scanf("%d%d", &N, &M);
  memset(G, +oo, sizeof(G));
  for (int i = 1; i <= N; ++i) {
    G[i][i] = 0;
  }
  for (int i = 1; i <= M; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    G[u][v] = G[v][u] = 1;
  }
}
void solve() {
  memcpy(dis, G, sizeof(dis));
  for (int k = 1; k <= N; ++k) {
    for (int i = 1; i <= N; ++i) {
      for (int j = 1; j <= N; ++j) {
        chkmin(dis[i][j], dis[i][k] + dis[k][j]);
      }
    }
  }
  memset(fs, -1, sizeof(fs));
  memset(ft, -1, sizeof(ft));
  fs[N] = 1;
  ft[1] = 1;
  countfs(1);
  countft(N);
  assert(fs[1] == ft[N]);
  long long max = fs[1];
  for (int i = 2; i < N; ++i) {
    chkmax(max, fs[i] * ft[i] * 2);
  }
  double ans = (double)max / fs[1];
  printf("%.12f\n", ans);
}
int main() {
  input();
  solve();
  return 0;
}
