#include <bits/stdc++.h>
using namespace std;
long long chu(long long a, long long b) {
  long long res = 1, p = 1000000007 - 2;
  while (p) {
    if (p & 1) {
      res = res * b % 1000000007;
    }
    b = b * b % 1000000007;
    p >>= 1;
  }
  return a * res % 1000000007;
}
int n, x, y, i, j, k, ac, wa, n0, n1, sb[666], nn;
long long res, jb;
struct Mat {
  long long mat[55][55] = {0};
  void print() {
    int i, j;
    for (i = 0; i <= n; i++) {
      for (j = 0; j <= n; j++) {
        printf("%lld ", mat[i][j]);
      }
      puts("");
    }
    puts("");
  }
} a, ans;
Mat operator*(Mat A, Mat B) {
  Mat temp;
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= n; j++) {
      for (int k = 0; k <= n; k++) {
        temp.mat[i][j] =
            (temp.mat[i][j] + A.mat[i][k] * B.mat[k][j]) % 1000000007;
      }
    }
  }
  return temp;
}
Mat operator^(Mat A, int k) {
  Mat base;
  for (int i = 0; i <= n; i++) base.mat[i][i] = 1;
  while (k) {
    if (k & 1) base = base * A;
    A = A * A;
    k = k >> 1;
  }
  return base;
}
int main() {
  scanf("%d%d", &n, &k);
  jb = chu(1, n * (n - 1) / 2);
  for (i = 1; i <= n; i++) {
    scanf("%d", &sb[i]);
    if (sb[i]) {
      n1++;
    } else {
      n0++;
    }
  }
  for (i = 1; i <= n0; i++) {
    if (sb[i]) {
      wa++;
    } else {
      ac++;
    }
  }
  for (i = n0 + 1; i <= n; i++) {
    if (sb[i]) {
      ac++;
    } else {
      wa++;
    }
  }
  ac /= 2;
  wa /= 2;
  n /= 2;
  ans.mat[0][wa] = 1;
  a.mat[0][1] = n0 * n1 * jb % 1000000007;
  a.mat[0][0] = (1 - a.mat[0][1] + 1000000007) % 1000000007;
  for (i = 1; i <= n - 1; i++) {
    nn++;
    n0 = max(0, n0 - 1);
    n1 = max(0, n1 - 1);
    a.mat[i][i - 1] = nn * nn * jb % 1000000007;
    a.mat[i][i + 1] = n0 * n1 * jb % 1000000007;
    a.mat[i][i] =
        (1 - a.mat[i][i + 1] - a.mat[i][i - 1] + 1000000007 + 1000000007) %
        1000000007;
  }
  nn++;
  n0 = max(0, n0 - 1);
  n1 = max(0, n1 - 1);
  a.mat[n][n - 1] = nn * nn * jb % 1000000007;
  a.mat[n][n] = (1 - a.mat[n][n - 1] + 1000000007) % 1000000007;
  a = a ^ k;
  ans = ans * a;
  printf("%lld", ans.mat[0][0]);
}
