#include <bits/stdc++.h>
using namespace std;
int n, m, o, re = 0;
long long res = 0;
int a[110];
pair<long long, int> tmp[2][110];
bool chk[110];
vector<int> ve[110];
queue<int> myq;
void visit(int d, int cc) {
  while (!myq.empty()) myq.pop();
  myq.push(d);
  tmp[cc][d] = pair<long long, int>(1, 0);
  while (!myq.empty()) {
    d = myq.front();
    myq.pop();
    for (vector<int>::iterator it = ve[d].begin(); it != ve[d].end(); it++) {
      if (tmp[cc][*it].second == tmp[cc][d].second + 1)
        tmp[cc][*it].first += tmp[cc][d].first;
      if (tmp[cc][*it].second != -1) continue;
      tmp[cc][*it] =
          pair<long long, int>(tmp[cc][d].first, tmp[cc][d].second + 1);
      myq.push(*it);
    }
  }
}
int main() {
  int i, j, k, l;
  long long ll, rr, mid;
  scanf("%d %d", &n, &m);
  for (i = 0; i < m; i++) {
    scanf("%d %d", &j, &k);
    ve[j].push_back(k);
    ve[k].push_back(j);
  }
  for (j = 0; j < 2; j++) {
    for (i = 1; i <= n; i++) {
      tmp[j][i] = pair<long long, int>(0, -1);
    }
  }
  visit(1, 0);
  visit(n, 1);
  double ans = 1;
  for (i = 2; i <= n - 1; i++) {
    if (tmp[0][i].second + tmp[1][i].second != tmp[0][n].second) continue;
    ans = max(
        ans, ((double)tmp[0][i].first * tmp[1][i].first) / tmp[0][n].first * 2);
  }
  printf("%.10lf", ans);
  return 0;
}
