#include <bits/stdc++.h>
using namespace std;
const int N = 1e2 + 5;
const int MOD = 1e9 + 7;
long long C[N][N];
void multiply(long long A[N][N], long long B[N][N], int n) {
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= n; j++) {
      for (int k = 0; k <= n; k++) {
        C[i][j] = (C[i][j] + A[i][k] * B[k][j]) % MOD;
      }
    }
  }
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= n; j++) {
      A[i][j] = C[i][j];
      C[i][j] = 0;
    }
  }
}
long long AM[N][N], B[N][N];
void matPower(int n, int sz) {
  if (n == 0) return;
  matPower(n >> 1, sz);
  multiply(AM, AM, sz);
  if (n & 1) multiply(AM, B, sz);
}
long long power(long long a, long long n, long long m = MOD) {
  if (n == 0) return 1;
  long long p = power(a, n >> 1, m);
  p = (p * p) % m;
  if (n & 1) p = (p * a) % m;
  return p;
}
int A[N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  int c = 0;
  for (int i = 1; i <= n; i++) {
    int a;
    cin >> a;
    A[i] = a;
    if (a == 0) c++;
  }
  int ip = 0;
  for (int i = 1; i <= c; i++) {
    if (A[i] == 0) ip++;
  }
  long long tot = (n * (n - 1)) >> 1;
  long long totInv = power(tot, MOD - 2);
  for (int i = 0; i <= c; i++) {
    AM[i][i] = 1;
    long long ip0 = i, ip1 = c - i;
    long long op0 = c - i, op1 = n - 2 * c + i;
    if (ip0 < 0 or ip1 < 0 or op0 < 0 or op1 < 0) continue;
    if (ip0 > c or ip1 > n - c or op0 > c or op1 > n - c) continue;
    long long cnt = 1;
    if (i) {
      B[i][i - 1] = (ip0 * op1 * totInv) % MOD;
      cnt -= B[i][i - 1];
    }
    if (i < c) {
      B[i][i + 1] = (ip1 * op0 * totInv) % MOD;
      cnt -= B[i][i + 1];
    }
    cnt %= MOD;
    if (cnt < 0) cnt += MOD;
    B[i][i] = cnt;
  }
  matPower(k, c);
  long long ans = AM[ip][c];
  cout << ans << "\n";
  return 0;
}
