#include <bits/stdc++.h>
using namespace std;
const int max_N = 100000 + 10;
long double s;
long long n, sz[max_N];
int a[max_N], par[max_N];
vector<pair<int, pair<int, int> > > e;
bool cmp(pair<int, pair<int, int> > a, pair<int, pair<int, int> > b) {
  return (a.first > b.first);
}
int find_par(int v) {
  if (par[v] != v) par[v] = find_par(par[v]);
  return par[v];
}
void dsu(int a, int b, long long c) {
  a = find_par(a), b = find_par(b);
  if (a == b) return;
  if (sz[a] < sz[b]) swap(a, b);
  s += (long double)(sz[a] * sz[b] * c) / (long double)(n * (n - 1) / 2);
  par[b] = a, sz[a] += sz[b], sz[b] = 0;
}
int main() {
  ios::sync_with_stdio(false);
  int m, u, v;
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) {
    cin >> u >> v;
    e.push_back(make_pair(min(a[--u], a[--v]), make_pair(u, v)));
  }
  sort(e.begin(), e.end(), cmp);
  for (int i = 0; i < n; i++) par[i] = i, sz[i] = 1;
  for (pair<int, pair<int, int> > t : e)
    dsu(t.second.first, t.second.second, t.first);
  cout << fixed << setprecision(6) << s << endl;
  return 0;
}
