#include <bits/stdc++.h>
using namespace std;
const int inf = 1000000000;
int n, m;
int mp[110][110];
long long from[110], to[110];
bool con[110][110];
long long f(int p) {
  if (from[p] > 0) {
    return from[p];
  }
  for (int i = 0; i < n; i++) {
    if (con[i][p] && mp[0][i] + mp[i][p] == mp[0][p]) {
      from[p] += f(i);
    }
  }
  return from[p];
}
long long t(int p) {
  if (to[p] > 0) {
    return to[p];
  }
  for (int i = 0; i < n; i++) {
    if (con[i][p] && mp[p][i] + mp[i][n - 1] == mp[p][n - 1]) {
      to[p] += t(i);
    }
  }
  return to[p];
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      mp[i][j] = inf;
      con[i][j] = false;
    }
  }
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    mp[x][y] = mp[y][x] = 1;
    con[x][y] = con[y][x] = true;
  }
  for (int i = 0; i < n; i++) {
    mp[i][i] = 0;
  }
  for (int k = 0; k < n; k++) {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        if (mp[i][k] + mp[k][j] < mp[i][j]) {
          mp[i][j] = mp[i][k] + mp[k][j];
        }
      }
    }
  }
  memset(from, 0, sizeof(from));
  from[0] = 1;
  for (int i = 1; i < n; i++) {
    from[i] = f(i);
  }
  memset(to, 0, sizeof(to));
  to[n - 1] = 1;
  for (int i = 0; i < n - 1; i++) {
    to[i] = t(i);
  }
  if (from[n - 1] != to[0]) {
    while (true)
      ;
  }
  long long ma = 0;
  for (int i = 1; i < n - 1; i++) {
    if (mp[0][i] + mp[i][n - 1] == mp[0][n - 1]) {
      ma = max(ma, from[i] * to[i] * 2);
    }
  }
  ma = max(ma, from[n - 1]);
  printf("%.12lf\n", double(ma) / double(from[n - 1]));
  return 0;
}
