#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N = 103;
int n, m, d[N], used[N], dist[N];
long long dp[N], f[N];
vector<int> adj[N];
void bfs(int v) {
  memset(&d, 0, sizeof(d));
  memset(&dp, 0, sizeof(dp));
  memset(&used, 0, sizeof(used));
  queue<int> q;
  q.push(v);
  dp[v] = 1;
  used[v] = 1;
  while (!q.empty()) {
    int cur = q.front();
    q.pop();
    for (int to : adj[cur]) {
      if (!used[to]) {
        d[to] = d[cur] + 1;
        q.push(to);
        used[to] = 1;
      }
      if (d[to] == d[cur] + 1) {
        dp[to] += dp[cur];
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL);
  cin >> n >> m;
  int x, y;
  for (int i = 1; i <= m; i++) {
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  bfs(1);
  for (int i = 1; i <= n; i++) {
    f[i] = dp[i];
    dist[i] = d[i];
  }
  bfs(n);
  long double ans = 0;
  for (int i = 1; i <= n; i++) {
    if (dist[i] + d[i] > d[1]) {
      continue;
    }
    long double tmp = f[i] * dp[i];
    tmp /= f[n];
    if (i != 1 && i != n) {
      tmp *= 2;
    }
    ans = max(ans, tmp);
  }
  cout << setprecision(30) << ans;
}
