#include <bits/stdc++.h>
using namespace std;
const int oo = (int)(1e9);
const long long OO = (long long)(1e18);
int n, m, a[1111], x[1111], y[1111];
double P[1111][1111];
void Init() {
  scanf("%d%d", &n, &m);
  ;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  ;
  for (int i = 0; i < m; i++) scanf("%d%d", &x[m - i - 1], &y[m - i - 1]);
  ;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) P[i][j] = (i < j);
  for (int i = 0; i < m; i++) {
    int u = x[i], v = y[i];
    for (int j = 1; j <= n; j++)
      if (j != u && j != v) {
        P[u][j] = P[v][j] = (P[u][j] + P[v][j]) / 2;
        P[j][u] = P[j][v] = (P[j][u] + P[j][v]) / 2;
      }
    P[u][v] = P[v][u] = (P[u][v] + P[v][u]) / 2;
  }
  double ans = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) ans += P[i][j] * (a[i] > a[j]);
  printf("%.9lf", ans);
}
int main() {
  Init();
  return 0;
}
