#include <bits/stdc++.h>
using namespace std;
const long long MX = 1e2 + 5;
vector<long long> g[MX];
long long vis[2][MX], ways[2][MX], dist[2][MX];
void bfs(long long x, long long idx) {
  vis[idx][x] = 1;
  queue<long long> q;
  q.push(x);
  ways[idx][x] = 1;
  while (!q.empty()) {
    long long node = q.front();
    q.pop();
    for (auto it : g[node]) {
      if (!vis[idx][it]) {
        dist[idx][it] = dist[idx][node] + 1;
        vis[idx][it] = 1;
        ways[idx][it] += ways[idx][node];
        q.push(it);
      } else {
        if (dist[idx][node] + 1 == dist[idx][it])
          ways[idx][it] += ways[idx][node];
      }
    }
  }
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n, m;
  cin >> n >> m;
  for (long long i = 0; i < m; i++) {
    long long x, y;
    cin >> x >> y;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  bfs(1, 0);
  bfs(n, 1);
  long long mx = -1;
  for (long long i = 1; i <= n; i++) {
    if (dist[0][i] + dist[1][i] != dist[0][n]) continue;
    long long cur = ways[0][i] * ways[1][i];
    if (i != 1 and i != n) cur *= 2;
    mx = max(mx, cur);
  }
  long double ans = (long double)mx / ways[0][n];
  cout << fixed << setprecision(12) << ans << '\n';
}
