#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return a % b == 0 ? b : gcd(b, a % b); }
const int MAXN = 110;
const int MAXM = MAXN * MAXN * 2;
struct Edge {
  int u, v, w;
  int next;
} edge[MAXM];
int N, M;
int head[MAXN], tot;
void init() {
  tot = 0;
  memset(head, -1, sizeof(head));
}
void add_edge(int u, int v, int w) {
  edge[tot].u = u;
  edge[tot].v = v;
  edge[tot].w = w;
  edge[tot].next = head[u];
  head[u] = tot++;
}
long long dp[MAXN];
long long dis[MAXN];
void bfs(int s) {
  memset(dis, -1, sizeof(dis));
  memset(dp, 0, sizeof(dp));
  dp[s] = 1;
  dis[s] = 0;
  queue<int> q;
  q.push(s);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = head[u]; i != -1; i = edge[i].next) {
      int v = edge[i].v;
      if (dis[v] == -1) {
        dis[v] = dis[u] + 1;
        dp[v] += dp[u];
        q.push(v);
      } else if (dis[v] == dis[u] + 1) {
        dp[v] += dp[u];
      }
    }
  }
}
int main() {
  cin >> N >> M;
  init();
  for (int i = 0; i < M; i++) {
    int u, v;
    cin >> u >> v;
    add_edge(u, v, 1);
    add_edge(v, u, 1);
  }
  bfs(1);
  double ret = 1.0;
  long long tot = dp[N], dist = dis[N];
  for (int i = 2; i <= N - 1; i++) {
    bfs(i);
    if (dis[1] + dis[N] == dist) {
      ret = max(ret, (2.0 * dp[1] * dp[N]) / (1.0 * tot));
    }
  }
  printf("%.10lf\n", ret);
  return 0;
}
