#include <bits/stdc++.h>
using namespace std;
long long n, m;
const long long INF = 1e16;
long long d[110][110], ways[110][110];
int main() {
  cin >> n >> m;
  for (long long i = 1; i <= n; i++)
    for (long long j = 1; j <= n; j++) d[i][j] = INF;
  for (long long i = 1; i <= m; i++) {
    long long x;
    long long y;
    cin >> x >> y;
    d[x][y] = 1;
    d[y][x] = 1;
    ways[x][y] = ways[y][x] = 1;
  }
  for (long long k = 1; k <= n; k++) {
    for (long long i = 1; i <= n; i++) {
      for (long long j = 1; j <= n; j++) {
        long long D = d[i][k] + d[k][j];
        if (D > d[i][j]) continue;
        if (D < d[i][j]) ways[i][j] = 0;
        ways[i][j] += ways[i][k] * ways[k][j];
        d[i][j] = D;
      }
    }
  }
  long double ans = 1.0;
  long double ret = 0.0;
  for (long long i = 2; i < n; i++) {
    long long D = d[1][i] + d[i][n];
    ret = 0.0;
    if (D == d[1][n]) {
      ret = (2.0 * ways[1][i] * ways[i][n]) / (1.0 * ways[1][n]);
    }
    ans = max(ans, ret);
  }
  cout << setprecision(12) << fixed << ans << endl;
  return 0;
}
