#include <bits/stdc++.h>
using namespace std;
unsigned long long dp1[105];
unsigned long long dp2[105];
int d1[105];
int d2[105];
vector<int> adj[105];
void bfs1(int s) {
  d1[s] = 0;
  dp1[s] = 1;
  queue<int> q;
  q.push(s);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = 0; i < ((int)adj[u].size()); ++i) {
      int v = adj[u][i];
      if (d1[v] == 1e8) {
        d1[v] = d1[u] + 1;
        dp1[v] = dp1[u];
        q.push(v);
      } else {
        if (d1[v] == d1[u] + 1) {
          dp1[v] += dp1[u];
        }
      }
    }
  }
}
void bfs2(int s) {
  d2[s] = 0;
  dp2[s] = 1;
  queue<int> q;
  q.push(s);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = 0; i < ((int)adj[u].size()); ++i) {
      int v = adj[u][i];
      if (d2[v] == 1e8) {
        d2[v] = d2[u] + 1;
        dp2[v] = dp2[u];
        q.push(v);
      } else {
        if (d2[v] == d2[u] + 1) {
          dp2[v] += dp2[u];
        }
      }
    }
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  int u, v;
  for (int i = 0; i < m; ++i) {
    cin >> u >> v;
    u--;
    v--;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  for (int i = 0; i < n; ++i) d1[i] = 1e8;
  bfs1(0);
  for (int i = 0; i < n; ++i) d2[i] = 1e8;
  bfs2(n - 1);
  double ans = 1.0;
  for (int i = 1; i < n - 1; ++i) {
    if (d1[i] + d2[i] == d1[n - 1]) {
      ans = max(ans, (2.0 * dp1[i] * dp2[i]) / dp1[n - 1]);
    }
  }
  cout << setprecision(12) << fixed << ans << endl;
  return 0;
}
