#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
struct MATRIX {
  int n;
  long long a[105][105];
  MATRIX(int n) : n(n) {
    for (int i = 0; i <= n; ++i)
      for (int j = 0; j <= n; ++j) a[i][j] = 0;
  }
  MATRIX operator*(const MATRIX &b) {
    MATRIX c(n);
    for (int i = 0; i <= n; ++i)
      for (int j = 0; j <= n; ++j)
        for (int k = 0; k <= n; ++k)
          c.a[i][j] = (c.a[i][j] + a[i][k] * b.a[k][j]) % mod;
    return c;
  }
};
int n, k, a[105], zero, one;
inline int nC2(int n) { return (n * (n - 1) / 2) % mod; }
MATRIX matPow(MATRIX a, int n) {
  MATRIX res(zero), t = a;
  for (int i = 0; i <= zero; ++i) res.a[i][i] = 1;
  while (n) {
    if (n & 1) res = res * t;
    t = t * t;
    n >>= 1;
  }
  return res;
}
long long pow(long long a, int n) {
  long long res = 1LL, t = a;
  while (n) {
    if (n & 1) res = res * t % mod;
    t = t * t % mod;
    n >>= 1;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    if (a[i] == 0)
      ++zero;
    else
      ++one;
  }
  MATRIX mat(zero);
  for (int zeroA = 0; zeroA <= zero; ++zeroA) {
    int oneA = zero - zeroA, zeroB = oneA, oneB = one - oneA;
    if (oneB < 0) continue;
    if (zeroA > 0 && oneA < one && zeroB < zero)
      mat.a[zeroA - 1][zeroA] = (oneA + 1) * (zeroB + 1) % mod;
    mat.a[zeroA][zeroA] =
        (nC2(zero) + nC2(one) + (oneA * zeroA) + (oneB * zeroB)) % mod;
    if (zeroA < zero && oneB < one)
      mat.a[zeroA + 1][zeroA] = (zeroA + 1) * (oneB + 1) % mod;
  }
  MATRIX res = matPow(mat, k);
  int zeroA = 0;
  for (int i = 1; i <= zero; ++i) zeroA += (a[i] == 0);
  long long sum = 0LL;
  for (int j = 0; j <= zero; ++j) sum = (sum + res.a[zeroA][j]) % mod;
  cout << 1LL * res.a[zeroA][zero] * pow(sum, mod - 2) % mod;
}
