#include <bits/stdc++.h>
using namespace std;
int dis[2012];
long double In[2012], Out[2012];
int in_e[2012], out_e[2012];
bool Used[2012];
vector<int> E[2012];
queue<int> Q;
int x, y, n, m;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d", &x, &y);
    E[x].push_back(y);
    E[y].push_back(x);
  }
  for (int i = 1; i <= n; ++i) dis[i] = 1000002012;
  dis[1] = 0;
  Q.push(1);
  while (Q.size()) {
    int Now = Q.front();
    Q.pop();
    for (vector<int>::iterator i = E[Now].begin(); i != E[Now].end(); ++i)
      if (dis[*i] > dis[Now] + 1) {
        dis[*i] = dis[Now] + 1;
        if (!Used[*i]) {
          Used[*i] = 1;
          Q.push(*i);
        }
      }
  }
  memset(Used, 0, sizeof(Used));
  Q.push(1);
  In[1] = 1;
  while (Q.size()) {
    int Now = Q.front();
    Q.pop();
    for (vector<int>::iterator i = E[Now].begin(); i != E[Now].end(); ++i)
      if (dis[*i] == dis[Now] + 1) {
        In[*i] += In[Now];
        if (!Used[*i]) Q.push(*i), Used[*i] = 1;
      }
  }
  memset(Used, 0, sizeof(Used));
  Q.push(n);
  Out[n] = 1;
  while (Q.size()) {
    int Now = Q.front();
    Q.pop();
    for (vector<int>::iterator i = E[Now].begin(); i != E[Now].end(); ++i)
      if (dis[*i] + 1 == dis[Now]) {
        Out[*i] += Out[Now];
        if (!Used[*i]) Q.push(*i), Used[*i] = 1;
      }
  }
  long double ans = 0;
  for (int i = 2; i < n; ++i) ans = max(ans, In[i] * Out[i] * 2);
  ans /= Out[1];
  if (dis[n] != 1000002012) ans = max((long double)1, ans);
  printf("%.12lf", (double)ans);
  return 0;
}
