#include <bits/stdc++.h>
using namespace std;
int gcd1(int a, int b) {
  if (a == 0) return b;
  return gcd1(b % a, a);
}
long long modx(long long base, long long ex) {
  long long ans = 1LL, val = base;
  while (ex > 0LL) {
    if (ex & 1LL) ans = (ans * val) % 1000000007LL;
    val = (val * val) % 1000000007LL;
    ex = ex >> 1LL;
  }
  return ans;
}
int n, m, x, y;
const int maxn = 105;
double dist[maxn][maxn], P[maxn][maxn];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) dist[i][j] = 3000;
    dist[i][i] = 0;
  }
  for (int i = 1; i <= m; i++) {
    cin >> x >> y;
    dist[x][y] = dist[y][x] = 1;
    P[x][y] = P[y][x] = 1;
  }
  for (int k = 1; k <= n; k++) {
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        int temp = dist[i][k] + dist[k][j];
        if (temp < dist[i][j]) {
          dist[i][j] = temp;
          P[i][j] = P[i][k] * P[k][j];
        } else if (temp == dist[i][j])
          P[i][j] += P[i][k] * P[k][j];
      }
    }
  }
  double y1 = P[1][n];
  for (int i = 2; i < n; i++) {
    if (dist[1][i] + dist[i][n] == dist[1][n])
      y1 = max(y1, 2 * P[1][i] * P[i][n]);
  }
  cout << fixed << setprecision(7) << (double)y1 / (double)P[1][n] << endl;
  return 0;
}
