#include <bits/stdc++.h>
using namespace std;
const int INF32 = 1E9;
const long long INF64 = 4E18;
const long long M = 1E9 + 7;
const double EPS = 1E-9;
const double PI = 2 * acos(0);
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& p) {
  os << "[ ";
  for (T x : p) os << x << " ";
  os << "]" << '\n';
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, const set<T>& p) {
  os << "{ ";
  for (T x : p) os << x << " ";
  os << "}" << '\n';
  return os;
}
template <typename Tk, typename Tv>
ostream& operator<<(ostream& os, const map<Tk, Tv>& p) {
  os << "{ ";
  for (pair<Tk, Tv> x : p) os << x << " ";
  os << "}" << '\n';
  return os;
}
template <typename Tk, typename Tv>
ostream& operator<<(ostream& os, const pair<Tk, Tv>& p) {
  os << "{" << p.first << ',' << p.second << "}";
  return os;
}
long long num_paths(int s, int t, int parent, vector<vector<long long> >& adj,
                    vector<vector<long long> >& cnt,
                    vector<vector<long long> >& dist) {
  if (s == t) return 1;
  if (adj[s][t] == 1) return 1;
  if (cnt[s][t] != -1) return cnt[s][t];
  cnt[s][t] = 0;
  for (int v = 0; v < (int)adj[s].size(); ++v) {
    if (adj[s][v] == 1 and v != parent) {
      if (dist[s][v] + dist[v][t] == dist[s][t]) {
        cnt[s][t] += num_paths(v, t, s, adj, cnt, dist);
      }
    }
  }
  return cnt[s][t];
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  if (fopen("tupni.txt", "r")) {
    freopen("tupni.txt", "r", stdin);
    freopen("tuptuo.txt", "w", stdout);
  }
  int n, m;
  cin >> n >> m;
  vector<vector<long long> > g(n), adj(n, vector<long long>(n, 0));
  for (int i = 0; i < m; ++i) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    g[u].push_back(v);
    g[v].push_back(u);
    adj[u][v] = 1;
    adj[v][u] = 1;
  }
  vector<vector<long long> > dist(n, vector<long long>(n, INF64)),
      cnt(n, vector<long long>(n, -1));
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (adj[i][j] == 1) {
        dist[i][j] = 1;
      }
      if (i == j) {
        dist[i][j] = 0;
      }
    }
  }
  for (int k = 0; k < n; ++k) {
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < n; ++j) {
        dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
      }
    }
  }
  double ans = 0, total = num_paths(0, n - 1, -1, adj, cnt, dist);
  for (int k = 0; k < n; ++k) {
    if (dist[0][k] + dist[k][n - 1] == dist[0][n - 1]) {
      double x1 = num_paths(0, k, -1, adj, cnt, dist);
      double x2 = num_paths(k, n - 1, -1, adj, cnt, dist);
      double avg;
      if (k == 0 or k == n - 1)
        avg = (x1 * x2) / total;
      else
        avg = (2 * x1 * x2) / total;
      ans = max(ans, avg);
    }
  }
  cout << fixed << setprecision(10) << ans << '\n';
  return 0;
}
