#include <bits/stdc++.h>
using namespace std;
bool block[105];
int dist[105], dist2[105];
long long ways[105], tmp[105];
vector<int> G[105];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    G[a].push_back(b);
    G[b].push_back(a);
  }
  queue<int> Q;
  Q.push(1);
  memset(dist, 0x7F, sizeof(dist));
  memset(ways, 0, sizeof(ways));
  ways[1] = 1;
  dist[1] = 0;
  while (!Q.empty()) {
    int u = Q.front();
    Q.pop();
    for (int i = 0; i < G[u].size(); ++i) {
      if (dist[G[u][i]] < dist[u] + 1) continue;
      if (!ways[G[u][i]]) {
        dist[G[u][i]] = dist[u] + 1;
        Q.push(G[u][i]);
      }
      ways[G[u][i]] += ways[u];
    }
  }
  double sol = 1.;
  for (int i = 1; i <= n; ++i) {
    if ((i == 1 || i == n)) continue;
    block[i] = 1;
    memset(tmp, 0, sizeof(tmp));
    memset(dist2, 0x7F, sizeof(dist2));
    Q.push(1);
    tmp[1] = 1;
    dist2[1] = 0;
    while (!Q.empty()) {
      int u = Q.front();
      Q.pop();
      for (int i = 0; i < G[u].size(); ++i) {
        if (block[G[u][i]]) continue;
        if (dist2[G[u][i]] < dist2[u] + 1) continue;
        if (!tmp[G[u][i]]) {
          dist2[G[u][i]] = dist2[u] + 1;
          Q.push(G[u][i]);
        }
        tmp[G[u][i]] += tmp[u];
      }
    }
    if (dist[n] != dist2[n]) tmp[n] = 0;
    long long have = ways[n] - tmp[n];
    double res = 2 * have / (double)ways[n];
    sol = max(res, sol);
    block[i] = 0;
  }
  printf("%.9lf\n", sol);
  return 0;
}
