#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
int n, k, zero, one, cnt;
int a[105];
long long A[105][105], A_k[105][105];
void mult(long long M[105][105], long long N[105][105]) {
  long long ret[105][105];
  memset(ret, 0, sizeof ret);
  for (int i = 0; i <= zero; ++i)
    for (int j = 0; j <= zero; ++j)
      if (M[i][j])
        for (int k = 0; k <= zero; ++k)
          ret[i][k] = (ret[i][k] + M[i][j] * N[j][k] % mod) % mod;
  for (int i = 0; i <= zero; ++i)
    for (int j = 0; j <= zero; ++j) M[i][j] = ret[i][j];
}
int main() {
  ios::sync_with_stdio(0);
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    if (a[i])
      one++;
    else
      zero++;
  }
  if (zero == 0 || one == 0) {
    cout << 1;
    return 0;
  }
  for (int i = 0; i < zero; ++i)
    if (a[i] == 0) cnt++;
  ;
  for (int i = max(zero - one, 0); i <= zero; ++i) {
    A[i][i] = zero * (zero - 1) / 2 + one * (one - 1) / 2 + i * (zero - i) +
              (zero - i) * (one - zero + i);
    if (i) A[i][i - 1] = (zero - i + 1) * (zero - i + 1);
    if (zero - i) A[i][i + 1] = (i + 1) * (one - zero + i + 1);
  }
  for (int i = 0; i <= zero; ++i) A_k[i][i] = 1;
  for (; k; k >>= 1) {
    if (k & 1) mult(A_k, A);
    mult(A, A);
  }
  long long ans = A_k[zero][cnt], down = 0;
  for (int i = 0; i <= zero; ++i) down = (down + A_k[i][cnt]) % mod;
  for (long long pow = mod - 2; pow; pow >>= 1) {
    if (pow & 1) ans = ans * down % mod;
    down = down * down % mod;
  }
  cout << ans;
}
