#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T gcd(T a, T b) {
  if (a < 0) return gcd(-a, b);
  if (b < 0) return gcd(a, -b);
  return (b == 0) ? a : gcd(b, a % b);
}
template <class T>
inline T lcm(T a, T b) {
  if (a < 0) return lcm(-a, b);
  if (b < 0) return lcm(a, -b);
  return a * (b / gcd(a, b));
}
template <class T>
inline T sqr(T x) {
  return x * x;
}
template <class T>
T power(T N, T P) {
  return (P == 0) ? 1 : N * power(N, P - 1);
}
long long toInt64(string s) {
  long long r = 0;
  istringstream sin(s);
  sin >> r;
  return r;
}
double LOG(long long N, long long B) { return (log10l(N)) / (log10l(B)); }
string itoa(long long a) {
  if (a == 0) return "0";
  string ret;
  for (long long i = a; i > 0; i = i / 10) ret.push_back((i % 10) + 48);
  reverse(ret.begin(), ret.end());
  return ret;
}
vector<string> token(string a, string b) {
  const char *q = a.c_str();
  while (count(b.begin(), b.end(), *q)) q++;
  vector<string> oot;
  while (*q) {
    const char *e = q;
    while (*e && !count(b.begin(), b.end(), *e)) e++;
    oot.push_back(string(q, e));
    q = e;
    while (count(b.begin(), b.end(), *q)) q++;
  }
  return oot;
}
int Set(int N, int pos) { return N = N | (1 << pos); }
int Reset(int N, int pos) { return N = N & ~(1 << pos); }
int check(int N, int pos) { return (N & (1 << pos)); }
int toggle(int N, int pos) {
  if (check(N, pos)) return N = Reset(N, pos);
  return N = Set(N, pos);
}
void PBIT(int N) {
  printf("(");
  for (int i = 10; i >= 0; i--) {
    bool x = check(N, i);
    cout << x;
  }
  puts(")");
}
vector<int> g[202];
long long d[202][202];
long long dp2[202][202];
int n, e;
long long call2(int u, int l) {
  if (l < 0) return 0;
  if (u == n) return 1;
  if (dp2[u][l] != -1) return dp2[u][l];
  long long ret = 0;
  for (int i = 0; i < (int)g[u].size(); i++) {
    int v = g[u][i];
    ret += call2(v, l - 1);
  }
  return dp2[u][l] = ret;
}
long long dp[202][202];
long long call(int u, int l) {
  if (l < 0) return 0;
  if (u == 1) return 1;
  if (dp[u][l] != -1) return dp[u][l];
  long long ret = 0;
  for (int i = 0; i < (int)g[u].size(); i++) {
    int v = g[u][i];
    ret += call(v, l - 1);
  }
  return dp[u][l] = ret;
}
int main() {
  memset(dp, -1, sizeof(dp));
  ;
  memset(dp2, -1, sizeof(dp2));
  ;
  cin >> n >> e;
  for (int i = 1; i <= (int)n; i++)
    for (int j = 1; j <= (int)n; j++)
      if (i != j) d[i][j] = (1 << 28);
  for (int i = 1; i <= (int)e; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    d[u][v] = d[v][u] = 1;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (int k = 1; k <= (int)n; k++)
    for (int i = 1; i <= (int)n; i++)
      for (int j = 1; j <= (int)n; j++)
        d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
  long long maxi = 0;
  long long mega = d[1][n];
  for (int i = 2; i < n; i++) {
    long long ret1 = call(i, d[i][1]);
    long long ret2 = call2(i, mega - d[i][1]);
    long long ret = ret1 * ret2;
    maxi = max(maxi, ret);
  }
  long long vag = call2(1, d[1][n]);
  maxi *= 2;
  double ans;
  if (maxi < vag)
    ans = 1;
  else
    ans = maxi / (double)vag;
  printf("%.8lf\n", ans);
  return 0;
}
