#include <bits/stdc++.h>
using namespace std;
void read(long long &x) {
  x = 0;
  long long f = 1;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = -f;
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
  x *= f;
}
void print(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (!x) return;
  print(x / 10), putchar(x % 10 + 48);
}
void write(long long x) {
  if (!x)
    putchar('0');
  else
    print(x);
  putchar('\n');
}
const long long maxn = 2e5 + 10;
const long long inf = 1e9;
const long double eps = 1e-12;
const long long mod = 1e9 + 7;
long long add(long long x, long long y) {
  return x + y >= mod ? x + y - mod : x + y;
}
long long del(long long x, long long y) {
  return x - y < 0 ? x - y + mod : x - y;
}
long long mul(long long x, long long y) {
  return 1ll * x * y - 1ll * x * y / mod * mod;
}
void inc(long long &x, long long y) {
  x += y;
  x %= mod;
}
long long n, k, a[maxn], res, c;
long long qpow(long long a, long long x) {
  long long res = 1;
  for (; x; x >>= 1, a = 1ll * a * a % mod)
    if (x & 1) res = 1ll * res * a % mod;
  return res;
}
struct Matrix {
  long long a, b, r[110][110];
  Matrix() { a = b = 0, memset(r, 0, sizeof r); }
  Matrix operator*(const Matrix &t) const {
    Matrix res;
    res.a = a, res.b = t.b;
    for (long long i = 0; i <= a; i++)
      for (long long j = 0; j <= t.b; j++)
        for (long long k = 0; k <= b; k++)
          res.r[i][j] = add(res.r[i][j], mul(r[i][k], t.r[k][j]));
    return res;
  }
} tr, ans;
signed main() {
  read(n), read(k);
  for (long long i = 1; i <= n; i++) read(a[i]), res += !(a[i] & 1);
  for (long long i = 1; i <= res; i++) c += !a[i];
  ans.a = 0, ans.b = res;
  ans.r[0][c] = 1;
  tr.a = tr.b = res;
  for (long long i = 0; i <= res; i++) {
    long long lw = i, lb = res - i, rw = res - lw, rb = n - res - lb;
    if (i != res) inc(tr.r[i][i + 1], lb * rw % mod);
    if (i != 0) inc(tr.r[i][i - 1], lw * rb % mod);
    inc(tr.r[i][i], (res * (res - 1) + (n - res) * (n - res - 1)) % mod *
                        qpow(2, mod - 2) % mod);
    inc(tr.r[i][i], (lw * lb + rw * rb) % mod);
  }
  long long x = k, f = 0;
  for (; x; x >>= 1, tr = tr * tr)
    if (x & 1) ans = ans * tr;
  for (long long i = 0, i_r = res; i <= i_r; i++) f = (f + ans.r[0][i]) % mod;
  write(ans.r[0][res] * qpow(f, mod - 2) % mod);
  return 0;
}
