#include <bits/stdc++.h>
using namespace std;
int N, C, cnt;
int A[33], P[33];
double dp[33][33][222], sol;
inline int f(int l, int r, int i) {
  if (i < l || i > r) return i;
  int ret = i - l + 1;
  int len = r - l + 1;
  ret = len - ret + 1;
  ret = l + ret - 1;
  return ret;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << setprecision(15) << fixed;
  cin >> N >> C;
  for (int I = 1; I <= N; I++) cin >> A[I];
  for (int I = 1; I <= N; I++)
    for (int K = I + 1; K <= N; K++) dp[I][K][0] = 1;
  for (int c = 1; c <= C; c++) {
    for (int I = 1; I <= N; I++) {
      for (int K = 1; K <= N; K++) {
        for (int l = 1; l <= N; l++) {
          for (int r = l; r <= N; r++) {
            int pi = f(l, r, I);
            int pk = f(l, r, K);
            dp[I][K][c] += dp[pi][pk][c - 1];
          }
        }
        dp[I][K][c] /= (N * (N - 1) / 2) + N;
      }
    }
  }
  for (int I = 1; I <= N; I++)
    for (int K = 1; K <= N; K++)
      if (A[I] > A[K]) {
        sol += dp[I][K][C];
      }
  cout << sol << endl;
}
