#include <bits/stdc++.h>
using namespace std;
const int maxN = 101;
const int maxM = 10010;
int gh[maxN + 2], ca[maxM + 2][2], ke[maxM * 2];
int n, m;
int d[maxN], d1[maxN];
double sl[maxN], sl1[maxN];
void init() {
  scanf("%i%i", &n, &m);
  for (int i = 0; i < m; i++) {
    scanf("%i %i", &ca[i][0], &ca[i][1]);
    ++gh[ca[i][0]];
    ++gh[ca[i][1]];
  }
  for (int i = 1; i < n + 2; i++) gh[i] += gh[i - 1];
  for (int i = 0; i < m; i++) {
    ke[gh[ca[i][0]]--] = ca[i][1];
    ke[gh[ca[i][1]]--] = ca[i][0];
  }
}
void loang(int s) {
  queue<int> hd;
  while (!hd.empty()) hd.pop();
  hd.push(s);
  memset(d, 255, sizeof(d));
  d[s] = 0;
  sl[s] = 1;
  while (!hd.empty()) {
    int u = hd.front();
    hd.pop();
    for (int i = gh[u] + 1; i < gh[u + 1] + 1; i++)
      if (d[ke[i]] == -1) {
        d[ke[i]] = d[u] + 1;
        sl[ke[i]] = sl[u];
        hd.push(ke[i]);
      } else if (d[ke[i]] == d[u] + 1)
        sl[ke[i]] += sl[u];
  }
}
void xuly() {
  loang(1);
  for (int i = 0; i < n + 2; i++) {
    sl1[i] = sl[i];
    d1[i] = d[i];
  }
  memset(sl, 0, sizeof(sl));
  loang(n);
  double sum = sl[1];
  double ans = 1;
  for (int cap = 2; cap < n; cap++)
    if (d1[cap] + d[cap] == d[1]) {
      ans = max(ans, 2 * (sl[cap] * sl1[cap]) / sum);
    }
  printf("%.9f", ans);
}
int main() {
  init();
  xuly();
  return 0;
}
