Problem: You are given a permutation of n numbers p1, p2, ..., pn. We perform k operations of the following type: choose uniformly at random two indices l and r (l ≤ r) and reverse the order of the elements pl, pl + 1, ..., pr. Your task is to find the expected value of the number of inversions in the resulting permutation.

Input

The first line of input contains two integers n and k (1 ≤ n ≤ 100, 1 ≤ k ≤ 109). The next line contains n integers p1, p2, ..., pn — the given permutation. All pi are different and in range from 1 to n.

The problem consists of three subproblems. The subproblems have different constraints on the input. You will get some score for the correct submission of the subproblem. The description of the subproblems follows.

  * In subproblem G1 (3 points), the constraints 1 ≤ n ≤ 6, 1 ≤ k ≤ 4 will hold. 
  * In subproblem G2 (5 points), the constraints 1 ≤ n ≤ 30, 1 ≤ k ≤ 200 will hold. 
  * In subproblem G3 (16 points), the constraints 1 ≤ n ≤ 100, 1 ≤ k ≤ 109 will hold. 

Output

Output the answer with absolute or relative error no more than 1e - 9.

Examples

Input

3 1
1 2 3


Output

0.833333333333333


Input

3 4
1 3 2


Output

1.458333333333334

Note

Consider the first sample test. We will randomly pick an interval of the permutation (1, 2, 3) (which has no inversions) and reverse the order of its elements. With probability <image>, the interval will consist of a single element and the permutation will not be altered. With probability <image> we will inverse the first two elements' order and obtain the permutation (2, 1, 3) which has one inversion. With the same probability we might pick the interval consisting of the last two elements which will lead to the permutation (1, 3, 2) with one inversion. Finally, with probability <image> the randomly picked interval will contain all elements, leading to the permutation (3, 2, 1) with 3 inversions. Hence, the expected number of inversions is equal to <image>.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const double EPS = 1e-8;
const double PI = acos(-1);
const int dy[] = {-1, 0, 1, 0};
const int dx[] = {0, 1, 0, -1};
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename Ch, typename Tr, typename C, typename = decltype(begin(C()))>
basic_ostream<Ch, Tr> &operator<<(basic_ostream<Ch, Tr> &os, const C &c) {
  os << '[';
  for (auto i = begin(c); i != end(c); ++i)
    os << (i == begin(c) ? "" : " ") << *i;
  return os << ']';
}
template <class S, class T>
ostream &operator<<(ostream &o, const pair<S, T> &t) {
  return o << '(' << t.first << ',' << t.second << ')';
}
template <int N, class Tp>
void output(ostream &, const Tp &) {}
template <int N, class Tp, class, class... Ts>
void output(ostream &o, const Tp &t) {
  if (N) o << ',';
  o << get<N>(t);
  output<N + 1, Tp, Ts...>(o, t);
}
template <class... Ts>
ostream &operator<<(ostream &o, const tuple<Ts...> &t) {
  o << '(';
  output<0, tuple<Ts...>, Ts...>(o, t);
  return o << ')';
}
template <class T>
void output(T t, char z = 10) {
  if (t < 0) t = -t, putchar(45);
  int c[20];
  int k = 0;
  while (t) c[k++] = t % 10, t /= 10;
  for (k || (c[k++] = 0); k;) putchar(c[--k] ^ 48);
  putchar(z);
}
template <class T>
void outputs(T t) {
  output(t);
}
template <class S, class... T>
void outputs(S a, T... t) {
  output(a, 32);
  outputs(t...);
}
template <class T>
void output(T *a, int n) {
  for (int i = 0; i < (int)(n); ++i) cout << a[i] << (i != n - 1 ? ',' : '\n');
}
template <class T>
void output(T *a, int n, int m) {
  for (int i = 0; i < (int)(n); ++i) output(a[i], m);
}
template <class T>
bool input(T &t) {
  int n = 1, c;
  for (t = 0; !isdigit(c = getchar()) && ~c && c - 45;)
    ;
  if (!~c) return 0;
  for (c - 45 && (n = 0, t = c ^ 48); isdigit(c = getchar());)
    t = 10 * t + c - 48;
  t = n ? -t : t;
  return 1;
}
template <class S, class... T>
bool input(S &a, T &...t) {
  input(a);
  return input(t...);
}
template <class T>
bool inputs(T *a, int n) {
  for (int i = 0; i < (int)(n); ++i)
    if (!input(a[i])) return 0;
  return 1;
}
double E[100][101];
double F[100][101];
int lt[40][40][40][40];
int rt[40][40][40][40];
int main() {
  int n, K;
  while (input(n, K)) {
    vector<int> p(n);
    for (int i = 0; i < (int)(n); ++i) {
      input(p[i]);
    }
    memset(E, 0, sizeof(E));
    for (int i = 0; i < (int)(n); ++i) {
      for (int j = i + 1; j <= n; ++j) {
        for (int k = i; k + 1 < j; ++k) {
          for (int l = k + 1; l < j; ++l) {
            if (p[k] > p[l]) E[i][j]++;
          }
        }
      }
    }
    memset(lt, -1, sizeof(lt));
    for (int i = 0; i < (int)(n); ++i) {
      for (int j = i + 1; j <= n; ++j) {
        vector<int> p(n);
        for (int i = 0; i < (int)(n); ++i) p[i] = i;
        reverse(p.begin() + i, p.begin() + j);
        for (int ii = 0; ii < (int)(n); ++ii) {
          for (int jj = ii + 1; jj <= n; ++jj) {
            if (ii <= i && j <= jj) {
              lt[i][j][ii][jj] = i;
              rt[i][j][ii][jj] = j;
            } else {
              int i1 = max(i, ii);
              int j1 = min(j, jj);
              if (p[i1] >= p[j1 - 1]) {
                lt[i][j][ii][jj] = p[j1 - 1];
                rt[i][j][ii][jj] = p[i1] + 1;
              }
            }
          }
        }
      }
    }
    double P = 1.0 / (n * (n + 1) / 2);
    for (int _ = 0; _ < (int)(K); ++_) {
      memset(F, 0, sizeof(F));
      for (int i = 0; i < (int)(n); ++i) {
        for (int j = i + 1; j <= n; ++j) {
          for (int ii = 0; ii < (int)(n); ++ii) {
            for (int jj = ii + 1; jj <= n; ++jj) {
              int i1 = max(i, ii);
              int j1 = min(j, jj);
              int i2 = lt[i][j][ii][jj];
              int j2 = rt[i][j][ii][jj];
              if (i1 >= j1) {
                F[ii][jj] += P * E[ii][jj];
                continue;
              }
              if (i2 == -1) {
              }
              int M = (j2 - i2) * (j2 - i2 - 1) / 2;
              if ((i <= ii && jj <= j) || (ii <= i && j <= jj)) {
                F[ii][jj] += P * (E[ii][jj] - E[i1][j1] + (M - E[i2][j2]));
              } else if (i <= ii) {
                F[ii][jj] += P * (E[j][jj] + (M - E[i2][j2]) + E[i][jj] -
                                  E[i][j] - E[j2][jj] + E[j2][j]);
              } else {
                F[ii][jj] += P * (E[ii][i] + (M - E[i2][j2]) + E[ii][j] -
                                  E[i][j] - E[ii][i2] + E[i][i2]);
              }
            }
          }
        }
      }
      for (int i = 0; i < (int)(n); ++i)
        for (int j = 0; j < (int)(n + 1); ++j) E[i][j] = F[i][j];
    }
    printf("%.15f\n", E[0][n]);
  }
}