#include <bits/stdc++.h>
using namespace std;
const int maxn = 111;
const int inf = 1e9;
double cnt[maxn][maxn], dis[maxn][maxn];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j) dis[i][j] = inf;
  for (int i = 0; i < n; ++i) dis[i][i] = 0;
  for (int i = 0; i < m; ++i) {
    int u, v;
    scanf("%d %d", &u, &v);
    u--, v--;
    dis[v][u] = cnt[u][v] = cnt[v][u] = dis[u][v] = 1;
  }
  for (int k = 0; k < n; ++k)
    for (int i = 0; i < n; ++i)
      for (int j = 0; j < n; ++j) {
        if (dis[i][j] > dis[i][k] + dis[k][j])
          dis[i][j] = dis[i][k] + dis[k][j], cnt[i][j] = cnt[i][k] * cnt[k][j];
        else if (dis[i][j] == dis[i][k] + dis[k][j])
          cnt[i][j] += cnt[i][k] * cnt[k][j];
      }
  for (int i = 0; i < n; ++i) cnt[i][i] = .5;
  double ans = 0.;
  for (int i = 0; i < n; ++i) {
    if (dis[0][i] + dis[i][n - 1] == dis[0][n - 1])
      ans = max(ans, 1. * cnt[0][i] * cnt[i][n - 1] / (cnt[0][n - 1]));
  }
  printf("%.17f\n", ans * 2);
  return 0;
}
