#include <bits/stdc++.h>
using namespace std;
const int N = 31, K = 201;
int n, k, p[N];
double dp[N][N][K];
int T(int i, int l, int r) {
  if (i < l || i > r) return i;
  return l + r - i;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 0; i <= n - 1; i++) cin >> p[i];
  for (int i = 0; i <= n - 1; i++)
    for (int j = 0; j <= i - 1; j++) {
      if (p[i] < p[j])
        dp[j][i][0] = 1.0;
      else
        dp[i][j][0] = 1.0;
    }
  for (int t = 1; t <= k; t++)
    for (int i = 0; i <= n - 1; i++)
      for (int j = 0; j <= n - 1; j++)
        for (int l = 0; l <= n - 1; l++)
          for (int r = l; r <= n - 1; r++) {
            int ti = T(i, l, r), tj = T(j, l, r);
            dp[ti][tj][t] += dp[i][j][t - 1] / (n * (n + 1) / 2.0);
          }
  double ans = 0.0;
  for (int i = 0; i <= n - 1; i++)
    for (int j = i + 1; j <= n - 1; j++) ans += dp[i][j][k];
  cout << fixed << setprecision(12) << ans;
}
