#include <bits/stdc++.h>
using namespace std;
int N, M, D[110][110], s, t, R[110];
long long P[110][110];
void bfs() {
  fill(R, R + N, N + 10);
  R[0] = 0;
  fill(&P[0][0], &P[0][0] + 110 * 110, 0);
  for (int j = 0; j < N; ++j) P[j][j] = 1;
  queue<pair<int, int> > Q;
  Q.push(make_pair(0, 0));
  while (!Q.empty()) {
    int city = Q.front().first, cost = Q.front().second;
    Q.pop();
    if (city == N - 1) break;
    for (int i = 0; i < N; ++i) {
      if (D[city][i] == 0 || R[i] < cost + 1) continue;
      if (R[i] > cost + 1) {
        Q.push(make_pair(i, cost + 1));
        R[i] = cost + 1;
      }
      for (int j = 0; j < N; ++j) P[i][j] += P[city][j];
    }
  }
}
int main() {
  while (cin >> N >> M) {
    fill(&D[0][0], &D[0][0] + 110 * 110, 0);
    for (int i = 0; i < M; ++i) {
      cin >> s >> t;
      --s, --t;
      D[s][t] = D[t][s] = 1;
    }
    bfs();
    long long best = P[N - 1][0];
    for (int i = 1; i + 1 < N; ++i) best = max(best, P[i][0] * P[N - 1][i] * 2);
    printf("%.8f\n", 1.0 * best / P[N - 1][0]);
  }
}
