#include <bits/stdc++.h>
using namespace std;
vector<int> path[1005];
long long d[105], t[105];
int n, m, u, v;
queue<int> q;
void work(int now) {
  for (int i = 1; i <= n; i++) {
    d[i] = 1 << 30;
    t[i] = 0;
  }
  d[now] = 0;
  t[now] = 1;
  q.push(now);
  while (!q.empty()) {
    u = q.front();
    q.pop();
    for (int i = 0; i < path[u].size(); i++) {
      v = path[u][i];
      if (d[v] > d[u] + 1) {
        d[v] = d[u] + 1;
        t[v] = t[u];
        q.push(v);
      } else if (d[v] == d[u] + 1) {
        t[v] += t[u];
      }
    }
  }
}
int main() {
  long long len = 0, tmp = 0;
  double ans = 1.0;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d %d", &u, &v);
    path[u].push_back(v);
    path[v].push_back(u);
  }
  int start = 1;
  work(start), start++;
  len = d[n], tmp = t[n];
  for (int i = start; i < n; i++) {
    start = 1;
    work(i);
    int see = 0;
    see = d[start] + d[n];
    if (see == len) {
      double k = 0;
      k = (double)(2.0 * t[start] * t[n]) / (1.0 * tmp);
      ans = max(ans, k);
    }
  }
  printf("%.12lf\n", ans);
  return 0;
}
