#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void input(T &x) {
  register char c = getchar();
  x = 0;
  int neg = 0;
  for (; ((c < 48 || c > 57) && c != '-'); c = getchar())
    ;
  if (c == '-') {
    neg = 1;
    c = getchar();
  }
  for (; c > 47 && c < 58; c = getchar()) {
    x = (x << 1) + (x << 3) + c - 48;
  }
  if (neg) x = -x;
}
inline long long bigmod(long long p, long long e, long long M) {
  long long ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p) % M;
    p = (p * p) % M;
  }
  return ret;
}
template <class T>
inline T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <class T>
inline T modinverse(T a, T M) {
  return bigmod(a, M - 2, M);
}
const int N = 1001;
int n, m, d[N][N], a, b;
int d1[N], d2[N];
double dp1[N], dp2[N];
void bfs(int s, int dest, int dd[], vector<int> &vec) {
  vector<int> vis(n + 1, 0);
  queue<int> q;
  q.push(s);
  dd[s] = 0;
  vis[s] = 1;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    vec.push_back(u);
    if (u == dest) break;
    for (int i = 1; i <= n; i++) {
      if (d[u][i] == 1 && vis[i] == 0) {
        dd[i] = 1 + dd[u];
        vis[i] = 1;
        q.push(i);
      }
    }
  }
}
int main() {
  input(n), input(m);
  memset(d, 0, sizeof(d));
  for (int i = 0; i < m; i++) {
    input(a), input(b);
    d[a][b] = 1;
    d[b][a] = 1;
  }
  for (int i = 1; i <= n; i++) d[i][i] = 0;
  vector<int> forw, bac;
  bfs(1, n, d1, forw);
  bfs(n, 1, d2, bac);
  int LIM = d1[n];
  for (int i = forw.size() - 1; i >= 0; i--) {
    int now = forw[i];
    if (now == n) {
      dp1[now] = 1;
    } else {
      for (int k = 1; k <= n; k++) {
        if (d[now][k] == 1 && d1[now] + 1 + d2[k] == LIM) {
          dp1[now] += dp1[k];
        }
      }
    }
  }
  for (int i = bac.size() - 1; i >= 0; i--) {
    int now = bac[i];
    if (now == 1) {
      dp2[now] = 1;
    } else {
      for (int k = 1; k <= n; k++) {
        if (d[now][k] == 1 && d2[now] + 1 + d1[k] == LIM) {
          dp2[now] += dp2[k];
        }
      }
    }
  }
  double ans = 0;
  for (int i = 1; i <= n; i++) {
    double sum = 0;
    int pivot = i;
    for (int k = 1; k <= n; k++) {
      if (d[pivot][k] == 1 || i == k) {
        if (d1[k] > d1[pivot]) {
          if (d1[pivot] + 1 + d2[k] == LIM) {
            sum += dp2[i] * dp1[k];
          }
        } else {
          if (d1[k] + 1 + d2[pivot] == LIM) {
            sum += dp1[i] * dp2[k];
          }
        }
      }
    }
    if (sum > ans) {
      ans = sum;
    }
  }
  printf("%.12lf\n", ans / dp2[n]);
  return 0;
}
