#include <bits/stdc++.h>
using namespace std;
const int N = 3005;
int a[N];
double f[N][N];
int rd() {
  int x = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') ch = getchar();
  while (ch >= '0' && ch <= '9')
    x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
  return x;
}
int main() {
  int n = rd(), q = rd();
  for (int i = 1; i <= n; i++) a[i] = rd();
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      if (a[i] > a[j]) f[i][j] = 1;
  for (int i = 1; i <= q; i++) {
    int x = rd(), y = rd();
    f[x][y] = f[y][x] = (f[x][y] + f[y][x]) / 2;
    for (int j = 1; j <= n; j++) {
      if (j == x || j == y) continue;
      f[x][j] = f[y][j] = (f[x][j] + f[y][j]) / 2;
      f[j][x] = f[j][y] = (f[j][x] + f[j][y]) / 2;
    }
  }
  double ans = 0;
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++) ans += f[i][j];
  printf("%.9f", ans);
  return 0;
}
