#include <bits/stdc++.h>
using namespace std;
int n, m, a, b, ms[111][111], d[111], w[111], dd[111];
double f[111], ff[111], ans;
int main() {
  cin >> n >> m;
  memset(ms, 63, sizeof(ms));
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    a--;
    b--;
    ms[a][b] = ms[b][a] = 1;
  }
  memset(d, 63, sizeof(d));
  d[0] = 0;
  f[0] = 1;
  memset(w, 0, sizeof(w));
  for (int i = 0; i < n; i++) {
    int o = 1e9, l;
    for (int i = 0; i < n; i++)
      if (!w[i] && d[i] < o) o = d[i], l = i;
    w[l] = 1;
    for (int i = 0; i < n; i++)
      if (o + ms[l][i] < d[i]) {
        d[i] = o + ms[l][i];
        f[i] = f[l];
      } else if (o + ms[l][i] == d[i])
        f[i] += f[l];
  }
  memset(dd, 63, sizeof(dd));
  dd[n - 1] = 0;
  ff[n - 1] = 1;
  memset(w, 0, sizeof(w));
  for (int i = 0; i < n; i++) {
    int o = 1e9, l;
    for (int i = 0; i < n; i++)
      if (!w[i] && dd[i] < o) o = dd[i], l = i;
    w[l] = 1;
    for (int i = 0; i < n; i++)
      if (o + ms[l][i] < dd[i]) {
        dd[i] = o + ms[l][i];
        ff[i] = ff[l];
      } else if (o + ms[l][i] == dd[i])
        ff[i] += ff[l];
  }
  for (int i = 0; i < n; i++) {
    double o = 0;
    for (int j = 0; j < n; j++)
      if (ms[i][j] == 1) {
        if (d[i] + 1 + dd[j] == d[n - 1]) o += f[i] * ff[j];
        if (dd[i] + 1 + d[j] == d[n - 1]) o += ff[i] * f[j];
      }
    ans = max(ans, o);
  }
  printf("%.10lf\n", ans / f[n - 1]);
  return 0;
}
