#include <bits/stdc++.h>
using namespace std;
struct edge {
  int u, v, w, next;
} edges[10100];
int head[110], nCount = 0;
void AddEdge(int U, int V, int W) {
  edges[++nCount].u = U;
  edges[nCount].v = V;
  edges[nCount].w = W;
  edges[nCount].next = head[U];
  head[U] = nCount;
}
int n, m;
int dist[110];
long long int f[110];
void BFS(int S) {
  queue<int> q;
  f[S] = 1;
  q.push(S);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int p = head[u]; p != -1; p = edges[p].next) {
      int v = edges[p].v;
      if (!dist[v]) {
        dist[v] = dist[u] + 1;
        f[v] += f[u];
        q.push(v);
      } else if (dist[v] == dist[u] + 1)
        f[v] += f[u];
    }
  }
}
int main() {
  memset(head, -1, sizeof(head));
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    AddEdge(u, v, 1);
    AddEdge(v, u, 1);
  }
  BFS(1);
  double ans = 1.0;
  long long int tot = f[n], mindist = dist[n];
  for (int i = 2; i <= n - 1; i++) {
    memset(dist, 0, sizeof(dist));
    memset(f, 0, sizeof(f));
    BFS(i);
    if (dist[1] + dist[n] == mindist)
      ans = max(ans, (2.0 * f[1] * f[n]) / (1.0 * tot));
  }
  printf("%.10lf\n", ans);
  return 0;
}
