#include <bits/stdc++.h>
using namespace std;
int n, k;
double dp[228][41][41];
int turn(int a, int x, int y) {
  if (x <= a && a <= y)
    return y + x - a;
  else
    return a;
}
int main() {
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  double ans = 0;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j) dp[0][i][j] = (a[j] < a[i]);
  int cn2 = n * (n - 1) / 2;
  for (int i = 1; i <= k; ++i)
    for (int x = 0; x < n; ++x)
      for (int y = x; y < n; ++y)
        for (int i1 = 0; i1 < n; ++i1)
          for (int j1 = 0; j1 < n; ++j1) {
            if (i1 == j1) continue;
            if (dp[i - 1][i1][j1] == 0) continue;
            int q = turn(i1, x, y);
            int w = turn(j1, x, y);
            dp[i][q][w] += dp[i - 1][i1][j1] / (cn2 + n);
          }
  for (int i = 0; i < n; ++i)
    for (int j = i + 1; j < n; ++j) ans += dp[k][i][j];
  cout.precision(14);
  cout << fixed << ans << endl;
}
