#include <bits/stdc++.h>
using namespace std;
namespace IO {
const unsigned int Buffsize = 1 << 15, Output = 1 << 24;
static char Ch[Buffsize], *S = Ch, *T = Ch;
inline char getc() {
  return ((S == T) && (T = (S = Ch) + fread(Ch, 1, Buffsize, stdin), S == T)
              ? 0
              : *S++);
}
static char Out[Output], *nowps = Out;
inline void flush() {
  fwrite(Out, 1, nowps - Out, stdout);
  nowps = Out;
}
template <typename T>
inline void read(T& x) {
  x = 0;
  static char ch;
  T f = 1;
  for (ch = getc(); !isdigit(ch); ch = getc())
    if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getc()) x = x * 10 + (ch ^ 48);
  x *= f;
}
template <typename T>
inline void write(T x, char ch = '\n') {
  if (!x) *nowps++ = '0';
  if (x < 0) *nowps++ = '-', x = -x;
  static unsigned int sta[111], tp;
  for (tp = 0; x; x /= 10) sta[++tp] = x % 10;
  for (; tp; *nowps++ = sta[tp--] ^ 48)
    ;
  *nowps++ = ch;
  if (nowps - Out >= 1 << 23) flush();
}
inline void getstr(char* q) {
  register char ch;
  for (ch = getc(); !isupper(ch); ch = getc())
    ;
  for (; isupper(ch); ch = getc()) *q++ = ch;
  *q = '\0';
}
inline void getwd(char& x) {
  for (x = getc(); !isupper(x); x = getc())
    ;
}
}  // namespace IO
using namespace IO;
void file() {}
inline void Chkmin(int& u, int v) { u > v ? u = v : 0; }
inline void Chkmax(int& u, int v) { u < v ? u = v : 0; }
inline void Chkmax(long long& u, long long v) { u < v ? u = v : 0; }
inline void Chkmin(long long& u, long long v) { u > v ? u = v : 0; }
const int MAXN = 101, mod = 1e9 + 7;
static int n, k, a[MAXN], cnt, ps;
inline void init() {
  read(n), read(k);
  for (register int i = (1); i <= (n); ++i) read(a[i]), cnt += a[i];
  for (register int i = (1); i <= (n - cnt); ++i) ps += a[i];
}
static int A[MAXN][MAXN], iv, ans[MAXN][MAXN];
inline int power(int u, int v) {
  register int sm;
  for (sm = 1; v; v >>= 1, u = (long long)u * u % mod)
    if (v & 1) sm = (long long)sm * u % mod;
  return sm;
}
static int C[MAXN][MAXN], bd;
inline void mul(int A[MAXN][MAXN], int B[MAXN][MAXN]) {
  for (register int i = (0); i <= (bd); ++i)
    for (register int j = (0); j <= (bd); ++j) {
      C[i][j] = 0;
      for (register int k = (0); k <= (bd); ++k)
        C[i][j] = (C[i][j] + (long long)A[i][k] * B[k][j]) % mod;
    }
  for (register int i = (0); i <= (bd); ++i)
    for (register int j = (0); j <= (bd); ++j) A[i][j] = C[i][j];
}
inline void solve() {
  bd = min(cnt, n - cnt);
  iv = power(n * (n - 1), mod - 2);
  for (register int i = (0); i <= (bd); ++i) {
    int vt = n * (n - 1);
    if (i) A[i][i - 1] = 2ll * i * i * iv % mod, vt -= 2 * i * i;
    if (i < bd)
      A[i][i + 1] = 2ll * (cnt - i) * (n - cnt - i) * iv % mod,
               vt -= 2 * (cnt - i) * (n - cnt - i);
    A[i][i] = (long long)vt * iv % mod, ans[i][i] = 1;
  }
  for (; k; k >>= 1, mul(A, A))
    if (k & 1) mul(ans, A);
  cout << ans[ps][0] << endl;
}
int main() {
  file();
  init();
  solve();
  return 0;
}
