#include <bits/stdc++.h>
using namespace std;
const long long inf = 0x3f3f3f3f3f3f3f3f;
long long n, m, d[105], _d[105], vis[105], dp[105], _dp[105];
vector<long long> g[1005];
long long call(long long v) {
  if (v == 1) return 1;
  if (dp[v] != -1) return dp[v];
  long long rtn = 0;
  for (long long u : g[v]) {
    if ((d[u] + 1) == d[v]) {
      rtn += call(u);
    }
  }
  return dp[v] = rtn;
}
long long _call(long long v) {
  if (v == n) return 1ll;
  if (_dp[v] != -1) return _dp[v];
  long long rtn = 0;
  for (long long u : g[v]) {
    if ((_d[u] + 1) == _d[v]) {
      rtn += _call(u);
    }
  }
  return _dp[v] = rtn;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  cin >> n >> m;
  for (long long i = 0; i < m; i++) {
    long long u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  memset(vis, 0, sizeof(vis));
  d[1] = 0;
  queue<long long> q;
  q.push(1);
  vis[1] = 1;
  while (!q.empty()) {
    long long v = q.front();
    q.pop();
    for (long long u : g[v]) {
      if (!vis[u]) {
        vis[u] = 1;
        q.push(u);
        d[u] = d[v] + 1;
      }
    }
  }
  memset(vis, 0, sizeof(vis));
  _d[n] = 0;
  q.push(n);
  vis[n] = 1;
  while (!q.empty()) {
    long long v = q.front();
    q.pop();
    for (long long u : g[v]) {
      if (!vis[u]) {
        vis[u] = 1;
        q.push(u);
        _d[u] = _d[v] + 1;
      }
    }
  }
  memset(dp, -1, sizeof(dp));
  memset(_dp, -1, sizeof(_dp));
  call(n);
  _call(1);
  long long ans = 0;
  for (long long i = 2; i < n; i++) {
    if (dp[i] == -1 || _dp[i] == -1) continue;
    ans = max(ans, 2 * dp[i] * _dp[i]);
  }
  double val = ans * 1.0 / call(n) * 1.0;
  cout << fixed << setprecision(12);
  val = max(val, 1.0);
  cout << val;
  return 0;
}
