#include <bits/stdc++.h>
using namespace std;
int n, m;
const int maxn = 110;
vector<int> road[maxn];
long long len_pos[maxn];
long long len_neg[maxn];
long long num_pos[maxn];
long long num_neg[maxn];
int vis[maxn];
void bfs_pos(int now) {
  memset(vis, 0, sizeof(vis));
  queue<int> s;
  len_pos[now] = 0;
  num_pos[now] = 1;
  s.push(now);
  vis[now] = 1;
  while (!s.empty()) {
    int u = s.front();
    s.pop();
    for (int i = 0; i < (int)road[u].size(); i++) {
      int v = road[u][i];
      if (!vis[v]) {
        vis[v] = 1;
        len_pos[v] = len_pos[u] + 1;
        num_pos[v] = num_pos[u];
        s.push(v);
      } else if (len_pos[v] == len_pos[u] + 1) {
        num_pos[v] += num_pos[u];
      }
    }
  }
}
void bfs_neg(int now) {
  memset(vis, 0, sizeof(vis));
  queue<int> s;
  len_neg[now] = 0;
  num_neg[now] = 1;
  s.push(now);
  vis[now] = 1;
  while (!s.empty()) {
    int u = s.front();
    s.pop();
    for (int i = 0; i < (int)road[u].size(); i++) {
      int v = road[u][i];
      if (!vis[v]) {
        vis[v] = 1;
        len_neg[v] = len_neg[u] + 1;
        num_neg[v] = num_neg[u];
        s.push(v);
      } else if (len_neg[v] == len_neg[u] + 1) {
        num_neg[v] += num_neg[u];
      }
    }
  }
}
int main() {
  scanf("%d%d", &n, &m);
  int x, y;
  while (m--) {
    scanf("%d%d", &x, &y);
    road[x].push_back(y);
    road[y].push_back(x);
  }
  bfs_pos(1);
  bfs_neg(n);
  double ans = 1.0;
  for (int i = 2; i < n; i++) {
    if (len_pos[i] + len_neg[i] != len_pos[n]) continue;
    ans = max(ans, 2.0 * num_pos[i] * num_neg[i] / num_pos[n]);
  }
  printf("%.12lf", ans);
  return 0;
}
