#include <bits/stdc++.h>
using namespace std;
const int MaxN = 100;
vector<int> g[MaxN];
long long cnt1[MaxN], cnt2[MaxN];
int dist1[MaxN], dist2[MaxN];
bool used[MaxN];
int q[MaxN];
int n, m;
long long res[MaxN];
void bfs() {
  int l = 0, r = 1;
  q[l] = 0;
  dist1[0] = 0;
  used[0] = true;
  while (l < r) {
    int cur = q[l++];
    for (int i = 0; i < (int)g[cur].size(); i++) {
      int to = g[cur][i];
      if (!used[to]) {
        dist1[to] = dist1[cur] + 1;
        used[to] = true;
        q[r++] = to;
      }
    }
  }
  l = 0, r = 1;
  q[l] = n - 1;
  dist2[n - 1] = 0;
  for (int i = 0; i < n; i++) used[i] = false;
  used[n - 1] = true;
  while (l < r) {
    int cur = q[l++];
    for (int i = 0; i < (int)g[cur].size(); i++) {
      int to = g[cur][i];
      if (!used[to]) {
        dist2[to] = dist2[cur] + 1;
        used[to] = true;
        q[r++] = to;
      }
    }
  }
}
void evaluate() {
  for (int i = 0; i < n; i++) used[i] = false;
  int l = 0, r = 1;
  q[l] = 0;
  used[0] = true;
  cnt1[0] = 1;
  while (l < r) {
    int cur = q[l++];
    for (int i = 0; i < (int)g[cur].size(); i++) {
      int to = g[cur][i];
      if (dist1[cur] + 1 != dist1[to]) continue;
      cnt1[to] += cnt1[cur];
      if (!used[to]) {
        used[to] = true;
        q[r++] = to;
      }
    }
  }
  l = 0, r = 1;
  q[l] = n - 1;
  for (int i = 0; i < n; i++) used[i] = false;
  used[n - 1] = true;
  cnt2[n - 1] = 1;
  while (l < r) {
    int cur = q[l++];
    for (int i = 0; i < (int)g[cur].size(); i++) {
      int to = g[cur][i];
      if (dist2[cur] + 1 != dist2[to]) continue;
      cnt2[to] += cnt2[cur];
      if (!used[to]) {
        used[to] = true;
        q[r++] = to;
      }
    }
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    x--, y--;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  bfs();
  evaluate();
  for (int v = 0; v < n; v++)
    for (int i = 0; i < (int)g[v].size(); i++) {
      int to = g[v][i];
      if (dist1[v] + 1 + dist2[to] == dist1[n - 1]) {
        res[v] += cnt1[v] * cnt2[to];
        res[to] += cnt1[v] * cnt2[to];
      }
    }
  long long ans = 0;
  for (int i = 0; i < n; i++) ans = max(ans, res[i]);
  printf("%.12f\n", ans / (double)cnt1[n - 1]);
}
