#include <bits/stdc++.h>
using namespace std;
const int MAXN = 110;
int N, K, S;
int perm[MAXN];
int state[MAXN][MAXN];
bool bio[MAXN * MAXN];
const int DIM = 230;
struct Matrix {
  double a[DIM][DIM];
  double *operator[](int r) { return a[r]; };
  Matrix(int x = 0) {
    memset(a, 0, sizeof a);
    if (x)
      for (int i = (0); i < (DIM); ++i) a[i][i] = x;
  }
} const I(1);
Matrix operator*(Matrix A, Matrix B) {
  Matrix C;
  for (int i = (0); i < (DIM); ++i)
    for (int j = (0); j < (DIM); ++j)
      for (int k = (0); k < (DIM); ++k) C[i][j] += A[i][k] * B[k][j];
  return C;
}
Matrix operator^(Matrix A, long long b) {
  Matrix R = I;
  for (; b > 0; b /= 2) {
    if (b % 2) R = R * A;
    A = A * A;
  }
  return R;
}
int rev(int x, int l, int r) {
  if (x < l || x > r) return x;
  return l + r - x;
}
int main() {
  scanf("%d%d", &N, &K);
  for (int i = (0); i < (N); ++i) scanf("%d", &perm[i]);
  memset(state, -1, sizeof state);
  for (int i = (0); i < (N); ++i)
    for (int j = (i + 1); j < (N); ++j)
      if (state[i][j] == -1) {
        state[i][j] = state[N - 1 - j][N - 1 - i] = S++;
      }
  int cnt = 0;
  for (int l = (0); l < (N); ++l)
    for (int r = (l); r < (N); ++r) ++cnt;
  Matrix T;
  T[S][S] = 1;
  for (int a = (0); a < (N); ++a)
    for (int b = (a + 1); b < (N); ++b) {
      int s = state[a][b];
      assert(s != -1);
      if (bio[s]) continue;
      bio[s] = true;
      for (int l = (0); l < (N); ++l)
        for (int r = (l); r < (N); ++r) {
          int aa = rev(a, l, r);
          int bb = rev(b, l, r);
          int t = state[min(aa, bb)][max(aa, bb)];
          if (aa < bb) {
            T[t][s] += 1.0 / cnt;
          } else {
            T[t][s] -= 1.0 / cnt;
            T[S][s] += 1.0 / cnt;
          }
        }
    }
  T = T ^ K;
  Matrix M;
  M[0][S] = 1;
  M = M * T;
  double ans = 0;
  for (int a = (0); a < (N); ++a)
    for (int b = (a + 1); b < (N); ++b) {
      int s = state[a][b];
      double w = M[0][s];
      if (perm[a] < perm[b])
        ans += w;
      else
        ans += 1 - w;
    }
  printf("%.15lf\n", ans);
  return 0;
}
