#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
const int MAXN = 150;
int N, M;
vector<int> adj[MAXN];
int len[MAXN][MAXN];
long long ways[MAXN][MAXN];
long long go(int a, int b) {
  if (a == b) {
    return 1;
  }
  long long &ret = ways[a][b];
  if (ret != -1) return ret;
  ret = 0;
  for (int i = 0; i < (int)adj[a].size(); i++) {
    if (len[a][adj[a][i]] + len[adj[a][i]][b] == len[a][b]) {
      ret += go(adj[a][i], b);
    }
  }
  return ret;
}
int main() {
  cin >> N >> M;
  memset(ways, -1, sizeof ways);
  for (int i = 0; i < MAXN; i++)
    for (int j = 0; j < MAXN; j++) len[i][j] = INF;
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    adj[a].push_back(b);
    adj[b].push_back(a);
    len[a][b] = len[b][a] = 1;
  }
  for (int k = 0; k < N; k++) {
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < N; j++) {
        len[i][j] = min(len[i][j], len[i][k] + len[k][j]);
      }
    }
  }
  for (int i = 0; i < N; i++) len[i][i] = 0;
  double mx = 1;
  long long tot = go(0, N - 1);
  for (int i = 1; i < N - 1; i++) {
    if (len[0][i] + len[i][N - 1] == len[0][N - 1]) {
      long long w = go(0, i) * go(i, N - 1) * 2;
      mx = max(mx, w / (double)tot);
    }
  }
  cout << fixed << setprecision(12) << mx << endl;
  return 0;
}
