#include <bits/stdc++.h>
using namespace std;
const int N = 105;
vector<int> adj[N];
int dis1[N], dis2[N], n, m;
bool vis[N], road[N];
long long cnt1[N], cnt2[N];
void spfa(int st, int ed, long long cnt[], int dis[]) {
  memset(vis, 0, sizeof(vis));
  queue<int> que;
  que.push(st);
  dis[st] = 0;
  vis[st] = 1;
  cnt[st] = 1;
  while (!que.empty()) {
    int top = que.front();
    que.pop();
    vis[top] = 0;
    for (int i = 0; i < (int)adj[top].size(); i++) {
      int to = adj[top][i];
      if (dis[to] > dis[top] + 1 || dis[to] == dis[top] + 1) {
        dis[to] = dis[top] + 1;
        if (dis[to] > dis[top] + 1) cnt[to] = 0;
        cnt[to] += cnt[top];
        if (!vis[to]) {
          vis[to] = 1;
          que.push(to);
        }
      }
    }
  }
}
int main() {
  while (scanf("%d%d", &n, &m) != EOF) {
    memset(cnt1, 0, sizeof(cnt1));
    memset(cnt2, 0, sizeof(cnt2));
    memset(dis1, 0x7f, sizeof(dis1));
    memset(dis2, 0x7f, sizeof(dis2));
    for (int i = 1; i <= n; i++) adj[i].clear();
    for (int i = 0; i < m; i++) {
      int a, b;
      scanf("%d%d", &a, &b);
      adj[a].push_back(b);
      adj[b].push_back(a);
    }
    spfa(1, n, cnt1, dis1);
    spfa(n, 1, cnt2, dis2);
    long long res = 0;
    for (int i = 1; i <= n; i++) {
      if (dis1[i] + dis2[i] == dis1[n]) {
        if (i == 1 || i == n)
          res = max(res, cnt1[i] * cnt2[i]);
        else
          res = max(res, cnt1[i] * cnt2[i] * 2);
      }
    }
    printf("%.10lf\n", res * 1.0 / cnt1[n]);
  }
  return 0;
}
