#include <bits/stdc++.h>
using namespace std;
pair<int, long double> forwards[109];
pair<int, long double> backwards[109];
vector<int> adj[109];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  queue<int> Q;
  for (int i = 0; i < n; i++) {
    forwards[i] = make_pair(INT_MAX, 0);
    backwards[i] = make_pair(INT_MAX, 0);
  }
  forwards[0] = make_pair(0, 1.0);
  backwards[n - 1] = make_pair(0, 1.0);
  Q.push(0);
  while (!Q.empty()) {
    int index = Q.front();
    Q.pop();
    for (int i = 0; i < adj[index].size(); i++) {
      if (forwards[index].first + 1 == forwards[adj[index][i]].first) {
        forwards[adj[index][i]].second += forwards[index].second;
      }
      if (forwards[index].first + 1 < forwards[adj[index][i]].first) {
        forwards[adj[index][i]] =
            make_pair(forwards[index].first + 1, forwards[index].second);
        Q.push(adj[index][i]);
      }
    }
  }
  Q.push(n - 1);
  while (!Q.empty()) {
    int index = Q.front();
    Q.pop();
    for (int i = 0; i < adj[index].size(); i++) {
      if (backwards[index].first + 1 == backwards[adj[index][i]].first) {
        backwards[adj[index][i]].second += backwards[index].second;
      }
      if (backwards[index].first + 1 < backwards[adj[index][i]].first) {
        backwards[adj[index][i]] =
            make_pair(backwards[index].first + 1, backwards[index].second);
        Q.push(adj[index][i]);
      }
    }
  }
  long double maxNum = 0;
  for (int i = 0; i < n; i++) {
    if (i == 0 || i == n - 1) {
      if (forwards[i].first + backwards[i].first == forwards[n - 1].first)
        maxNum = max(maxNum, forwards[i].second * backwards[i].second);
    } else {
      if (forwards[i].first + backwards[i].first == forwards[n - 1].first)
        maxNum = max(maxNum, 2 * forwards[i].second * backwards[i].second);
    }
  }
  cout << fixed << setprecision(12) << maxNum / forwards[n - 1].second << endl;
}
