#include <bits/stdc++.h>
using namespace std;
vector<int> v[105];
double ways[105], road[105], opt[105];
int lev[105], pol;
int n, m, a, b;
double bfs(int x) {
  long long ans = 0;
  lev[x] = 0;
  road[x] = 0;
  ways[x] = 1;
  opt[x] = 1;
  queue<int> q;
  q.push(x);
  while (!q.empty()) {
    int y = q.front();
    q.pop();
    for (int i = 0; i < v[y].size(); i++) {
      if (lev[v[y][i]] == -1) {
        ways[v[y][i]] = ways[y];
        road[v[y][i]] = road[y];
        opt[v[y][i]] = opt[y];
        lev[v[y][i]] = lev[y] + 1;
        if (pol == v[y][i] || pol == y) road[v[y][i]]++;
        q.push(v[y][i]);
      } else if (lev[v[y][i]] == lev[y] + 1) {
        ways[v[y][i]] += ways[y];
        if (road[v[y][i]] < road[y] + (pol == y) + (pol == v[y][i])) {
          road[v[y][i]] = road[y] + (pol == y) + (pol == v[y][i]);
          opt[v[y][i]] = opt[y];
        } else if (road[v[y][i]] == (road[y] + (pol == y) + (pol == v[y][i]))) {
          opt[v[y][i]] += opt[y];
        }
      }
    }
  }
  return ans = (road[n] * opt[n]);
}
int main() {
  scanf("%d", &n), scanf("%d", &m);
  for (int i = 0; i < m; i++) {
    scanf("%d", &a), scanf("%d", &b);
    v[a].push_back(b);
    v[b].push_back(a);
  }
  double ans = 0;
  for (int i = 1; i <= n; i++) {
    memset(lev, -1, sizeof(lev));
    pol = i;
    double bval = bfs(1);
    ans = max(ans, bval);
  }
  printf("%.6lf\n", ans / ways[n]);
  return 0;
}
