#include <bits/stdc++.h>
using namespace std;
int n, m, dis1[105], dis2[105];
long double dp1[105], dp2[105];
vector<int> edg[105];
bool vis[105];
long double ans = LDBL_MIN;
void bfs(int i, long double* dp, int* dis) {
  memset(vis, 0, sizeof(vis));
  vis[i] = true;
  queue<int> ord;
  ord.push(i);
  dp[i] = 1;
  while (ord.size() != 0) {
    int top = ord.front();
    ord.pop();
    for (int j = 0; j < edg[top].size(); j++) {
      if (!vis[edg[top][j]]) {
        vis[edg[top][j]] = true;
        ord.push(edg[top][j]);
        dis[edg[top][j]] = dis[top] + 1;
        dp[edg[top][j]] += dp[top];
      } else if (dis[edg[top][j]] == (dis[top] + 1)) {
        dp[edg[top][j]] += dp[top];
      }
    }
  }
}
int main() {
  int precision = numeric_limits<long double>::digits10;
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    edg[u].push_back(v);
    edg[v].push_back(u);
  }
  bfs(1, dp1, dis1);
  bfs(n, dp2, dis2);
  ans = max(ans, (long double)1);
  for (int i = 2; i <= n - 1; i++) {
    if (dis1[i] + dis2[i] == dis1[n]) {
      ans = max(ans, ((dp1[i] * dp2[i] * 2.0) / dp1[n]));
    }
  }
  cout << setprecision(precision);
  cout << ans << endl;
}
