#include <bits/stdc++.h>
using namespace std;
double p[32][32][210];
int A[32];
int main() {
  int n, K, i, j, k, a, b, ra, rb, s;
  double r;
  scanf("%d%d", &n, &K);
  for (i = 1; i <= n; i++) scanf("%d", A + i);
  memset(p, 0.0, sizeof(p));
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      if (i == j) continue;
      if (A[i] > A[j])
        p[i][j][0] = 1;
      else
        p[j][i][0] = 1;
    }
  }
  s = n * (n + 1) / 2;
  for (k = 1; k <= K; k++) {
    for (a = 1; a <= n; a++) {
      for (b = a + 1; b <= n; b++) {
        for (i = 1; i <= n; i++) {
          for (j = i; j <= n; j++) {
            if (i > b) {
              ra = a;
              rb = b;
            } else if (i > a) {
              if (j < b) {
                ra = a;
                rb = b;
              } else {
                ra = a;
                rb = i + j - b;
              }
            } else {
              if (j < b && j >= a) {
                ra = i + j - a;
                rb = b;
              } else if (j >= b) {
                ra = i + j - a;
                rb = i + j - b;
              } else {
                ra = a;
                rb = b;
              }
            }
            p[ra][rb][k] += p[a][b][k - 1] / s;
          }
        }
      }
    }
    for (b = 1; b < n; b++) {
      for (a = b + 1; a <= n; a++) {
        for (i = 1; i <= n; i++) {
          for (j = i; j <= n; j++) {
            if (i > a) {
              ra = a;
              rb = b;
            } else if (i > b) {
              if (j < a) {
                ra = a;
                rb = b;
              } else {
                ra = i + j - a;
                rb = b;
              }
            } else {
              if (j < a && j >= b) {
                ra = a;
                rb = i + j - b;
              } else if (j >= a) {
                ra = i + j - a;
                rb = i + j - b;
              } else {
                ra = a;
                rb = b;
              }
            }
            p[ra][rb][k] += p[a][b][k - 1] / s;
          }
        }
      }
    }
  }
  double jin = 0.0;
  for (i = 1; i < n; i++) {
    for (j = i + 1; j <= n; j++) jin += p[i][j][K];
  }
  printf("%.14lf\n", jin);
}
