#include <bits/stdc++.h>
using namespace std;
template <class T>
T f_min(T x, T y) {
  return x < y ? x : y;
}
template <class T>
T f_max(T x, T y) {
  return x > y ? x : y;
}
template <class T>
T f_abs(T x) {
  return x < 0 ? -x : x;
}
struct Edge {
  int u, v, next;
};
Edge edge[20005];
int head[105], en;
int N, M;
void insert(int u, int v) {
  edge[en].u = u;
  edge[en].v = v;
  edge[en].next = head[u];
  head[u] = en++;
}
void get_data() {
  int i, u, v;
  scanf("%d%d", &N, &M);
  memset(head, -1, sizeof head);
  en = 0;
  for (i = 0; i < M; i++) {
    scanf("%d%d", &u, &v);
    insert(u, v);
    insert(v, u);
  }
}
struct Unit {
  int id, dis;
  Unit() {}
  Unit(int _id, int _dis) {
    id = _id;
    dis = _dis;
  }
  bool friend operator<(Unit a, Unit b) { return a.dis > b.dis; }
};
priority_queue<Unit> que;
int dis[105];
double cnt[105];
void spfa() {
  memset(dis, -1, sizeof dis);
  memset(cnt, 0, sizeof cnt);
  que.push(Unit(1, 0));
  dis[1] = 0;
  cnt[1] = 1;
  int i, u, v;
  Unit t;
  while (que.size()) {
    t = que.top();
    que.pop();
    if (t.dis != dis[t.id]) continue;
    u = t.id;
    for (i = head[u]; i != -1; i = edge[i].next) {
      v = edge[i].v;
      if (dis[v] == -1 || dis[v] > dis[u] + 1) {
        dis[v] = dis[u] + 1;
        cnt[v] = cnt[u];
        que.push(Unit(v, dis[v]));
      } else if (dis[v] == dis[u] + 1) {
        cnt[v] += cnt[u];
      }
    }
  }
}
priority_queue<Unit> que2;
int dis2[105];
double cnt2[105];
void spfa2() {
  memset(dis2, -1, sizeof dis2);
  memset(cnt2, 0, sizeof cnt2);
  que2.push(Unit(N, 0));
  dis2[N] = 0;
  cnt2[N] = 1;
  int i, u, v;
  Unit t;
  while (que2.size()) {
    t = que2.top();
    que2.pop();
    if (t.dis != dis2[t.id]) continue;
    u = t.id;
    for (i = head[u]; i != -1; i = edge[i].next) {
      v = edge[i].v;
      if (dis2[v] == -1 || dis2[v] > dis2[u] + 1) {
        dis2[v] = dis2[u] + 1;
        cnt2[v] = cnt2[u];
        que2.push(Unit(v, dis2[v]));
      } else if (dis2[v] == dis2[u] + 1) {
        cnt2[v] += cnt2[u];
      }
    }
  }
}
void run() {
  spfa();
  spfa2();
  int i;
  double vmax = 0, temp;
  for (i = 1; i <= N; i++) {
    if (dis[i] + dis2[i] != dis[N]) continue;
    if (i == 1) {
      temp = (cnt2[i]) / cnt[N];
    } else if (i == N) {
      temp = (cnt[i]) / cnt[N];
    } else {
      temp = (cnt[i] * cnt2[i] * 2) / cnt[N];
    }
    if (temp > vmax) vmax = temp;
  }
  printf("%.12lf\n", vmax);
}
int main() {
  get_data();
  run();
  return 0;
}
