#include <bits/stdc++.h>
using namespace std;
double PI = acos(-1);
int const N = 5e5 + 10, M = 1e7 + 1, oo = 1e9;
const int mod = oo + 9;
const long long OO = 3e18;
int n, m, dist[2][101], vis[2][101];
vector<int> adj[101];
long long cnt[2][101];
void bfs(int u, int md) {
  queue<int> q;
  q.push(u);
  vis[md][u] = 1;
  dist[md][u] = 0;
  cnt[md][u] = 1;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (auto v : adj[u]) {
      if (vis[md][v]) {
        if (dist[md][u] + 1 == dist[md][v]) cnt[md][v] += cnt[md][u];
      } else {
        dist[md][v] = dist[md][u] + 1;
        cnt[md][v] = cnt[md][u];
        vis[md][v] = 1;
        q.push(v);
      }
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  bfs(1, 0);
  bfs(n, 1);
  long long mx = 0, wh = -1;
  for (int i = 1; i <= n; i++) {
    if (dist[0][i] + dist[1][i] == dist[0][n]) {
      if (i == 1 && i != n) {
        if (cnt[1][1] > mx) {
          mx = cnt[1][1];
          wh = i;
        }
      } else if (i != 1 && i == n) {
        if (cnt[0][n] > mx) {
          mx = cnt[0][n];
          wh = i;
        }
      } else {
        if (cnt[0][i] * cnt[1][i] * 2 > mx) {
          mx = cnt[0][i] * cnt[1][i] * 2;
          wh = i;
        }
      }
    }
  }
  cout << fixed << setprecision(9) << mx * 1.0 / cnt[0][n] << endl;
  return 0;
}
