#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:128777216")
using namespace std;
const double pi = acos(-1.0);
vector<int> e[100];
long long cnt1[200];
long long cnt2[200];
int st[200];
int dist1[200];
int dist2[200];
void bfs(int i, long long* cnt, int* dist) {
  cnt[i] = 1;
  st[0] = i;
  memset(dist, 127, sizeof(dist1));
  dist[i] = 0;
  for (int d = 0, u = 1; d < u; d++) {
    int v = st[d], nd = dist[v] + 1;
    vector<int>& e = ::e[v];
    for (int j = 0; j < e.size(); j++) {
      int to = e[j];
      if (dist[to] > nd) {
        dist[to] = nd;
        cnt[to] = cnt[v];
        st[u++] = to;
      } else if (dist[to] == nd) {
        cnt[to] += cnt[v];
      }
    }
  }
}
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; i++) {
    int v1, v2;
    scanf("%d %d", &v1, &v2);
    v1--, v2--;
    e[v1].push_back(v2);
    e[v2].push_back(v1);
  }
  bfs(0, cnt1, dist1);
  bfs(n - 1, cnt2, dist2);
  long long q = cnt1[n - 1], p = 0, dist = dist1[n - 1];
  for (int i = 0; i < n; i++) {
    vector<int>& e = ::e[i];
    long long cur = 0;
    for (int j = 0; j < e.size(); j++) {
      int v2 = e[j];
      if (dist1[i] + dist2[v2] + 1 == dist) {
        cur += cnt1[i] * cnt2[v2];
      }
      if (dist1[v2] + dist2[i] + 1 == dist) {
        cur += cnt1[v2] * cnt2[i];
      }
    }
    if (cur > p) {
      p = cur;
    }
  }
  printf("%.15lf\n", double(p) / q);
  return 0;
}
