#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
int n, m;
double dp_mai[155], dp_cul[155];
int d_mai[155], d_cul[155];
bool adj[155][155], used[155];
void dijk(int source, int *d, double *dp) {
  fill(d + 1, d + n + 1, INF);
  memset(used, 0, sizeof(used));
  d[source] = 0;
  dp[source] = 1.;
  for (int(i) = 0; (i) < (n); i++) {
    int id, low = INF;
    for (int(j) = (1); (j) <= (n); j++) {
      if (used[j]) continue;
      if (low > d[j]) {
        low = d[j];
        id = j;
      }
    }
    used[id] = true;
    for (int(j) = (1); (j) <= (n); j++) {
      if (used[j] || !adj[id][j]) continue;
      if (d[j] > d[id] + 1) {
        d[j] = d[id] + 1;
        dp[j] = dp[id];
      } else if (d[j] == d[id] + 1) {
        dp[j] += dp[id];
      }
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  int x, y;
  for (int(i) = 0; (i) < (m); i++) {
    cin >> x >> y;
    adj[x][y] = adj[y][x] = true;
  }
  dijk(n, d_mai, dp_mai);
  dijk(1, d_cul, dp_cul);
  double res = 0.;
  for (int(i) = (1); (i) <= (n); i++) {
    double temp = 0.;
    for (int(j) = (1); (j) <= (n); j++) {
      if (!adj[i][j]) continue;
      if (d_mai[i] + d_cul[j] + 1 == d_mai[1]) temp += dp_mai[i] * dp_cul[j];
      if (d_cul[i] + d_mai[j] + 1 == d_cul[n]) temp += dp_cul[i] * dp_mai[j];
    }
    res = max(res, temp);
  }
  cout << fixed << setprecision(10) << res / dp_mai[1] << '\n';
  return 0;
}
