#include <bits/stdc++.h>
using namespace std;
int adj[110][110], nadj[110], a, b, n, m, mar[110];
unsigned long long d[110], e[110], num;
vector<int> pre[110], pos[110];
void dij(int s, vector<int> *p) {
  for (int i = 1; i < n + 1; i++) p[i].clear(), d[i] = 0x7FFFFFFF;
  queue<int> q;
  memset((mar), (0), sizeof(mar));
  d[s] = 0;
  q.push(s);
  mar[s] = 1;
  while (!q.empty()) {
    a = q.front();
    q.pop();
    for (int i = 0; i < nadj[a]; i++) {
      b = adj[a][i];
      if (d[a] + 1 < d[b]) {
        p[b].clear();
        p[b].push_back(a);
        d[b] = d[a] + 1;
      } else if (d[a] + 1 == d[b]) {
        p[b].push_back(a);
        d[b] = d[a] + 1;
      }
      if (mar[b]) continue;
      mar[b] = 1;
      q.push(b);
    }
  }
}
double solve() {
  for (int i = 1; i < n + 1; i++)
    pre[i].clear(), pos[i].clear(), d[i] = 0x7FFFFFFF;
  queue<int> q;
  dij(1, pre);
  dij(n, pos);
  memset((d), (0), sizeof(d));
  q.push(n);
  d[n] = 1;
  while (!q.empty()) {
    a = q.front();
    q.pop();
    for (int i = 0; i < pre[a].size(); i++) {
      b = pre[a][i];
      if (!d[b]) q.push(b);
      d[b] += d[a];
    }
  }
  memset((e), (0), sizeof(e));
  q.push(1);
  e[1] = 1;
  while (!q.empty()) {
    a = q.front();
    q.pop();
    for (int i = 0; i < pos[a].size(); i++) {
      b = pos[a][i];
      if (!e[b]) q.push(b);
      e[b] += e[a];
    }
  }
  num = 0;
  for (int i = 2; i < n; i++) num = max(num, d[i] * e[i] * 2);
  num = max(num, max(d[1], e[n]));
  return (d[1] > 0) ? (((double)num) / d[1]) : 0;
}
int main() {
  scanf("%d%d", &n, &m);
  memset((nadj), (0), sizeof(nadj));
  for (int i = 0; i < m; i++)
    scanf("%d%d", &a, &b), adj[a][nadj[a]++] = b, adj[b][nadj[b]++] = a;
  printf("%.7lf\n", solve());
  return 0;
}
