#include <bits/stdc++.h>
using namespace std;
const int MXN = 131;
vector<int> ngbr[MXN];
long long dp[2][MXN];
bool mark[MXN];
void input();
int n, m, dis[2][MXN];
void BFS(int v) {
  int f = (v == n - 1);
  queue<int> q;
  for (int i = 0; i < n; i++) dp[f][i] = 0, mark[i] = false, dis[f][i] = MXN;
  mark[v] = true;
  dp[f][v] = 1;
  dis[f][v] = 0;
  q.push(v);
  while (!q.empty()) {
    int p = q.front();
    for (int i = 0; i < int(ngbr[p].size()); i++) {
      int r = ngbr[p][i];
      if (dis[f][p] < dis[f][r]) dp[f][r] += dp[f][p];
      if (!mark[r]) {
        q.push(r);
        dis[f][r] = dis[f][p] + 1;
        mark[r] = true;
      }
    }
    q.pop();
  }
}
int main() {
  input();
  BFS(0);
  BFS(n - 1);
  double MX = dp[0][n - 1];
  for (int i = 1; i < n - 1; i++)
    if (dis[0][i] + dis[1][i] == dis[0][n - 1])
      MX = max(MX, double(2 * dp[0][i] * dp[1][i]));
  cout << fixed << setprecision(12) << MX / double(dp[0][n - 1]) << endl;
  return 0;
}
void input() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    ngbr[a].push_back(b);
    ngbr[b].push_back(a);
  }
}
