#include <bits/stdc++.h>
using namespace std;
const long double PI = 3.1415926535897932384626433832795;
const long double EPS = 1e-11;
int n, m, first, second;
bool a[110][110];
pair<long double, int> find_k(int s, int e) {
  queue<int> q;
  int ur[110];
  long double kr[110];
  memset(ur, 0xFF, sizeof(ur));
  memset(kr, 0, sizeof(kr));
  q.push(s);
  ur[s] = 1;
  kr[s] = 1.0;
  int p;
  while (!q.empty()) {
    p = q.front();
    q.pop();
    for (int i = 0; i < (n); i++)
      if ((a[p][i]) && (ur[i] + 1 == ur[p])) kr[p] += kr[i];
    for (int i = 0; i < (n); i++)
      if ((a[p][i]) && (ur[i] == -1)) {
        ur[i] = ur[p] + 1;
        q.push(i);
      }
  }
  return make_pair(kr[e], ur[e] - 1);
}
int main() {
  cout << setiosflags(ios::fixed) << setprecision(10);
  cin >> n >> m;
  for (int i = 0; i < (m); i++) {
    cin >> first >> second;
    first--;
    second--;
    a[first][second] = 1;
    a[second][first] = 1;
  }
  pair<long double, int> k = find_k(0, n - 1);
  if (k.first == 0) cout << "LOLO";
  long double ans = 1.0;
  for (int i = 1; i < n - 1; i++) {
    pair<long double, int> k1 = find_k(0, i), k2 = find_k(i, n - 1);
    if (k1.second + k2.second == k.second)
      ans = max(ans, 2.0 * k1.first * k2.first / k.first);
  }
  cout << ans;
  return 0;
}
