#include <bits/stdc++.h>
using namespace std;
const int maxl = 10;
int a[maxl];
int n, k;
long long int cnt;
void inv() {
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) cnt += (a[i] > a[j]);
}
void bt(int x) {
  if (x == 0) {
    inv();
    return;
  }
  for (int i = 0; i < n; i++)
    for (int j = i; j < n; j++) {
      reverse(a + i, a + j + 1);
      bt(x - 1);
      reverse(a + i, a + j + 1);
    }
}
long long int comb() {
  long long int tmp = (n + 1) * n, res = 1;
  tmp /= 2;
  for (int i = 0; i < k; i++) res *= tmp;
  return res;
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  bt(k);
  long double ans = (long double)(cnt) / (long double)(comb());
  cout << setprecision(10) << fixed;
  cout << ans << endl;
}
