#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 7;
const int N = 2e2 + 10;
int a[N][N];
int n;
int flag[N];
pair<long long, long long> ans[N];
void floyd() {
  for (int i = 1; i <= n; i++) a[i][i] = 0;
  for (int k = 1; k <= n; k++) {
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        a[i][j] = min(a[i][j], a[i][k] + a[k][j]);
      }
    }
  }
}
pair<long long, long long> dfs(int x) {
  if (ans[x].first != -1) return ans[x];
  long long ans1 = 0, ans2 = 0;
  if (x == n) ans1++;
  for (int i = 1; i <= n; i++) {
    if (a[x][i] == 1 && a[1][x] + 1 == a[1][i]) {
      long long a1, a2;
      tie(a1, a2) = dfs(i);
      ans1 += a1;
      ans2 += a2;
    }
  }
  if (flag[x]) swap(ans1, ans2);
  return ans[x] = {ans1, ans2};
}
int main() {
  int m;
  cin >> n >> m;
  memset((a), (0x3f), sizeof(a));
  while (m--) {
    int x, y;
    cin >> x >> y;
    a[x][y] = a[y][x] = 1;
  }
  double res = 0;
  floyd();
  for (int i = 1; i <= n; i++) {
    memset((ans), (0xff), sizeof(ans));
    flag[i] = 1;
    long long a1, a2;
    tie(a1, a2) = dfs(1);
    double alpha = 2;
    if (i == 1 || i == n) alpha = 1;
    res = max(res, alpha * a2 / (a1 + a2));
    flag[i] = 0;
  }
  printf("%.15f\n", res);
  return 0;
}
