#include <bits/stdc++.h>
using namespace std;
int a[10];
double re = 0;
double xx;
int n, k;
void dfs(int k) {
  if (k == 0) {
    int cnt = 0;
    for (int i = 1; i <= n; i++)
      for (int j = 1; j < i; j++) {
        if (a[j] > a[i]) cnt++;
      }
    re += cnt * xx;
    return;
  }
  for (int i = 0; i <= n; i++) {
    for (int l = 1; l + i <= n; l++) {
      int r = l + i;
      for (int t = 0; t <= i / 2; t++) {
        int tmp = a[l + t];
        a[l + t] = a[r - t];
        a[r - t] = tmp;
      }
      dfs(k - 1);
      for (int t = 0; t <= i / 2; t++) {
        int tmp = a[l + t];
        a[l + t] = a[r - t];
        a[r - t] = tmp;
      }
    }
  }
}
int main() {
  scanf("%d%d", &n, &k);
  int t = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    t += i;
  }
  xx = 1.0;
  for (int i = 1; i <= k; i++) xx /= t;
  dfs(k);
  printf("%.15lf", re);
  return 0;
}
