#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9 + 7;
const int N = (int)3e5 + 4;
const int M = 1001;
int n, k;
int a[6];
double ans;
void f(int s) {
  if (s == k) {
    for (int i = 0; i < n; ++i) {
      for (int j = i + 1; j < n; ++j) {
        if (a[i] > a[j]) {
          ++ans;
        }
      }
    }
    return;
  }
  for (int i = 0; i < n; ++i) {
    for (int j = i; j < n; ++j) {
      reverse(a + i, a + j + 1);
      f(s + 1);
      reverse(a + i, a + j + 1);
    }
  }
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  f(0);
  for (int i = 0; i < k; ++i) {
    ans /= n;
    ans /= (n + 1);
    ans *= 2.0;
  }
  printf("%.10lf", ans);
  return 0;
}
