#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 5;
long long n, m;
vector<long long> g[N];
long long dist[N][2], ways[N][2], vis[N][2];
void bfs(long long k, long long idx) {
  queue<long long> q;
  q.push(k);
  vis[k][idx] = 1;
  dist[k][idx] = 0;
  ways[k][idx] = 1;
  while (!q.empty()) {
    long long node;
    node = q.front();
    q.pop();
    for (auto it : g[node]) {
      if (!vis[it][idx]) {
        vis[it][idx] = 1;
        dist[it][idx] = dist[node][idx] + 1;
        ways[it][idx] = ways[node][idx] + ways[it][idx];
        q.push(it);
      } else {
        if (dist[node][idx] + 1 == dist[it][idx]) {
          ways[it][idx] = ways[node][idx] + ways[it][idx];
        }
      }
    }
  }
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> m;
  for (long long i = 1; i <= m; i++) {
    long long u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  bfs(1, 0);
  bfs(n, 1);
  long long max = 0;
  for (long long i = 1; i <= n; i++) {
    if (dist[i][0] + dist[i][1] == dist[n][0]) {
      long long road;
      if (i == 1 || i == n) {
        road = 1;
      } else {
        road = 2;
      }
      long long cur;
      cur = ways[i][0] * ways[i][1] * road;
      if (max < cur) {
        max = cur;
      }
    }
  }
  long long totways = ways[n][0];
  long double ans = (long double)max / totways;
  cout << fixed << setprecision(12) << ans;
  return 0;
}
