#include <bits/stdc++.h>
using namespace std;
inline int read() {
  char ch = getchar();
  int x = 0, f = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while ('0' <= ch && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int n, k;
int sum0, sum1;
struct mat {
  int a[110][110];
  mat() { memset(a, 0, sizeof(a)); }
  inline mat operator*(const mat& rhs) const {
    mat ret;
    for (int i = (0); i <= (sum0); ++i)
      for (int j = (0); j <= (sum0); ++j) {
        for (int k = (0); k <= (sum0); ++k) {
          ret.a[i][j] += 1ll * a[i][k] * rhs.a[k][j] % 1000000007;
          if (ret.a[i][j] >= 1000000007) ret.a[i][j] -= 1000000007;
        }
      }
    return ret;
  }
} bas;
int c[110];
inline mat Power(mat x, int y) {
  mat ret;
  ret = x;
  --y;
  while (y) {
    if (y & 1) ret = ret * x;
    x = x * x;
    y >>= 1;
  }
  return ret;
}
inline int Power(int x, int y) {
  int ret = 1;
  while (y) {
    if (y & 1) ret = 1ll * ret * x % 1000000007;
    x = 1ll * x * x % 1000000007;
    y >>= 1;
  }
  return ret;
}
int main() {
  n = read(), k = read();
  for (int i = (1); i <= (n); ++i) c[i] = read();
  sum0 = 0, sum1 = 0;
  int a = 0, st = 0;
  for (int i = (1); i <= (n); ++i) {
    if (c[i]) {
      ++sum1;
    } else {
      ++sum0;
      ++a;
    }
  }
  for (int i = (1); i <= (a); ++i) {
    if (!c[i]) ++st;
  }
  for (int j = (0); j <= (sum0); ++j) {
    int inv = Power(n * (n - 1) / 2, 1000000007 - 2);
    bas.a[j][j] = 1ll *
                  (a * (a - 1) / 2 + (n - a) * (n - a - 1) / 2 +
                   j * (sum0 - j) + (a - j) * (sum1 - a + j)) *
                  inv % 1000000007;
    if (j) bas.a[j][j - 1] = 1ll * j * (sum1 - a + j) * inv % 1000000007;
    if (j < sum0) {
      bas.a[j][j + 1] =
          1ll * (a - j) * (sum0 - j) % 1000000007 * inv % 1000000007;
    }
  }
  mat p;
  p.a[0][st] = 1;
  p = p * Power(bas, k);
  printf("%d\n", p.a[0][sum0]);
}
