#include <bits/stdc++.h>
using namespace std;
template <class _T>
inline _T sqr(const _T& x) {
  return x * x;
}
template <class _T>
inline string tostr(const _T& a) {
  ostringstream os("");
  os << a;
  return os.str();
}
const long double PI = 3.1415926535897932384626433832795L;
const long double EPS = 1e-11;
char TEMPORARY_CHAR;
const int INF = 0x3f3f3f3f;
const int N = 1 << 16;
inline void input(int& a) {
  a = 0;
  while ((TEMPORARY_CHAR = getchar()) > '9' || TEMPORARY_CHAR < '0') {
  }
  while (TEMPORARY_CHAR <= '9' && TEMPORARY_CHAR >= '0') {
    a = (a << 3) + (a << 1) + TEMPORARY_CHAR - '0';
    TEMPORARY_CHAR = getchar();
  }
}
int a[100];
long long t[2][101];
long long c[2][101];
vector<vector<int> > g;
void bfs(int v, int p) {
  t[p][v] = 0;
  c[p][v] = 1;
  queue<int> q;
  q.push(v);
  while (!q.empty()) {
    v = q.front();
    q.pop();
    for (__typeof((g[v]).begin()) it = (g[v]).begin(); it != (g[v]).end();
         it++) {
      int to = *it;
      if (t[p][to] == -1) {
        t[p][to] = t[p][v] + 1;
        c[p][to] += c[p][v];
        q.push(to);
      } else if (t[p][to] == t[p][v] + 1)
        c[p][to] += c[p][v];
    }
  }
}
int main() {
  int(n);
  input((n));
  ;
  int(m);
  input((m));
  ;
  memset(t, -1, sizeof(t));
  memset(c, 0, sizeof(c));
  g.resize(n);
  for (int i = 0; i < (int)(m); i++) {
    int(a);
    input((a));
    ;
    int(b);
    input((b));
    ;
    g[a - 1].push_back(b - 1);
    g[b - 1].push_back(a - 1);
  }
  bfs(0, 0);
  bfs(n - 1, 1);
  long long ans = c[0][n - 1];
  for (int i = 1; i < n - 1; i++)
    if (t[0][i] + t[1][i] == t[1][0]) ans = max(ans, 2 * c[0][i] * c[1][i]);
  cout << fixed;
  cout << setprecision(20);
  cout << (long double)ans / (long double)c[0][n - 1];
  return 0;
}
