#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long double PI = 3.141592653589793238462643383279502884197;
priority_queue<int, vector<int>, greater<int> > pq;
queue<int> q;
vector<int> v[100];
int ldist[100], rdist[100];
long long lrotn[100], rrotn[100];
void bfs(int *dist, long long *rotn, int st) {
  memset(dist, -1, sizeof(ldist));
  dist[st] = 0;
  rotn[st] = 1;
  q.push(st);
  int tv;
  while (!q.empty()) {
    tv = q.front();
    q.pop();
    for (int i = 0; i < (int)(v[tv]).size(); i++) {
      if (dist[v[tv][i]] == -1) {
        q.push(v[tv][i]);
        dist[v[tv][i]] = dist[tv] + 1;
        rotn[v[tv][i]] = rotn[tv];
      } else if (dist[v[tv][i]] == dist[tv] + 1)
        rotn[v[tv][i]] += rotn[tv];
    }
  }
}
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  int a, b;
  while (m--) {
    scanf("%d %d", &a, &b);
    a--;
    b--;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  bfs(ldist, lrotn, 0);
  bfs(rdist, rrotn, n - 1);
  double mav = 1;
  for (int i = 1; i < n - 1; i++) {
    if (ldist[n - 1] == ldist[i] + rdist[i])
      mav = max(mav, (double)2 * lrotn[i] / lrotn[n - 1] * rrotn[i]);
  }
  printf("%.7lf", mav);
}
