#include <bits/stdc++.h>
using namespace std;
const int64_t MOD = 1e9 + 7;
void add(int64_t& a, int64_t b) { a = (a + b) % MOD; }
void mul(int64_t& a, int64_t b) { a = (a * b) % MOD; }
int64_t extgcd(int64_t a, int64_t b, int64_t& x, int64_t& y) {
  int64_t d = a;
  if (b != 0) {
    d = extgcd(b, a % b, y, x);
    y -= (a / b) * x;
  } else {
    x = 1;
    y = 0;
  }
  return d;
}
int64_t inv_mod(int64_t a) {
  int64_t x, y;
  extgcd(a, MOD, x, y);
  return (MOD + x % MOD) % MOD;
}
const int SZ = 100;
void matmul(int64_t A[SZ][SZ], int64_t B[SZ][SZ]) {
  int64_t ret[SZ][SZ] = {0};
  for (int i = 0; i < SZ; i++)
    for (int j = 0; j < SZ; j++)
      for (int k = 0; k < SZ; k++) add(ret[i][j], A[i][k] * B[k][j]);
  for (int i = 0; i < SZ; i++)
    for (int j = 0; j < SZ; j++) A[i][j] = ret[i][j];
}
int main() {
  int N, K, A[100];
  cin >> N >> K;
  for (int i = 0; i < N; i++) cin >> A[i];
  int one = accumulate(A, A + N, 0);
  int zero = N - one;
  int d = 0;
  for (int i = 0; i < zero; i++) d += A[i];
  int64_t M[100][100] = {0}, S[100][100] = {0};
  for (int i = 0; i <= min(one, zero); i++) {
    S[i][i] = 1;
    M[i][i] = one * (one - 1) / 2 + zero * (zero - 1) / 2 + i * (N - 2 * i);
    if (i < min(one, zero)) M[i + 1][i] = (zero - i) * (one - i);
    if (i > 0) M[i - 1][i] = i * i;
  }
  int64_t c = 1, base = N * (N - 1) / 2;
  while (K > 0) {
    if (K & 1) {
      mul(c, base);
      matmul(S, M);
    }
    matmul(M, M);
    mul(base, base);
    K /= 2;
  }
  int64_t ans = S[0][d];
  mul(ans, inv_mod(c));
  cout << ans << endl;
  return 0;
}
