#include <bits/stdc++.h>
using namespace std;
long long n, m;
vector<long long> g[110];
long long disfrom1[110], disfromn[110];
long long totpath[110], totpathn[110];
bool used[110];
void bfs1() {
  queue<long long> q;
  used[1] = 1;
  q.push(1);
  totpath[1] = 1;
  while (!q.empty()) {
    long long k = q.front();
    q.pop();
    for (int i = 0; i < g[k].size(); i++) {
      long long to = g[k][i];
      if (!used[to]) {
        used[to] = 1;
        q.push(to);
        disfrom1[to] = disfrom1[k] + 1;
      }
      if (disfrom1[to] == disfrom1[k] + 1) {
        totpath[to] += totpath[k];
      }
    }
  }
}
void bfsn() {
  queue<long long> q;
  q.push(n);
  used[n] = 1;
  totpathn[n] = 1;
  while (!q.empty()) {
    long long k = q.front();
    q.pop();
    for (int i = 0; i < g[k].size(); i++) {
      long long to = g[k][i];
      if (!used[to]) {
        used[to] = 1;
        q.push(to);
        disfromn[to] = disfromn[k] + 1;
      }
      if (disfromn[to] == disfromn[k] + 1) {
        totpathn[to] += totpathn[k];
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    long long a, b;
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  bfs1();
  memset(used, 0, sizeof used);
  bfsn();
  long long tt = totpath[n];
  double sol = 1;
  for (int i = 1; i <= n; i++) {
    long long tn1 = 0;
    long long tnn = 0;
    long long mm1 = disfrom1[n] + 10;
    long long mmn = disfromn[1] + 10;
    for (int j = 0; j < g[i].size(); j++) {
      long long to = g[i][j];
      mm1 = min(mm1, disfrom1[to]);
      mmn = min(mmn, disfromn[to]);
    }
    if (mm1 + mmn + 2 == disfrom1[n]) {
      for (int j = 0; j < g[i].size(); j++) {
        long long to = g[i][j];
        if (disfrom1[to] == mm1) {
          tn1 += totpath[to];
        } else if (disfromn[to] == mmn) {
          tnn += totpathn[to];
        }
      }
      long long tp = tn1 * tnn;
      sol = max(sol, (tp * 2.0) / tt);
    }
  }
  cout << setprecision(8) << fixed;
  cout << sol << endl;
  return 0;
}
