#include <bits/stdc++.h>
using namespace std;
const long long N = 107;
const long long MOD = 1000 * 1000 * 1000 + 7;
inline long long mod(long long n) {
  if (n < MOD)
    return n;
  else
    return n % MOD;
}
long long fp(long long a, long long p) {
  long long ans = 1, cur = a;
  for (long long i = 0; (1ll << i) <= p; ++i) {
    if ((p >> i) & 1) ans = mod(ans * cur);
    cur = mod(cur * cur);
  }
  return ans;
}
long long dv(long long a, long long b) { return mod(a * fp(b, MOD - 2)); }
struct md {
  long long n;
  md(long long x) { n = mod(x); }
  md() {}
  md operator+(md x) { return md(n + x.n); }
  md operator*(md x) { return md(n * x.n); }
  md operator/(md x) { return md(dv(n, x.n)); }
};
long long cnt[2];
bool a[N];
md m[N][N], ans[N][N], t[N][N];
void add(md a[N][N], md b[N][N]) {
  for (long long i = 0; i < N; ++i) {
    for (long long j = 0; j < N; ++j) {
      t[i][j].n = 0;
    }
  }
  for (long long i = 0; i < N; ++i) {
    for (long long j = 0; j < N; ++j) {
      for (long long k = 0; k < N; ++k) {
        t[i][j] = t[i][j] + a[i][k] * b[k][j];
      }
    }
  }
  for (long long i = 0; i < N; ++i) {
    for (long long j = 0; j < N; ++j) {
      a[i][j] = t[i][j];
    }
  }
}
void pw(long long p) {
  for (long long i = 0; i < N; ++i) {
    ans[i][i].n = 1;
  }
  for (long long i = 0; (1ll << i) <= p; ++i) {
    if ((p >> i) & 1) add(ans, m);
    add(m, m);
  }
}
md all(long long n, long long k) { return md(fp(n * (n - 1) / 2, k)); }
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n, k;
  cin >> n >> k;
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
    ++cnt[a[i]];
  }
  for (long long i = 0; i <= cnt[0] && i <= cnt[1]; ++i) {
    long long l = cnt[0];
    long long r = n - l;
    long long l1 = i;
    long long l0 = l - l1;
    long long r0 = cnt[0] - l0;
    long long r1 = cnt[1] - l1;
    if (i) m[i][i - 1] = md(l1 * r0);
    m[i][i + 1] = md(l0 * r1);
    m[i][i] = md(l * (l - 1) / 2 + r * (r - 1) / 2 + l0 * r0 + l1 * r1);
  }
  pw(k);
  long long sum = 0;
  for (long long i = 0; i < cnt[0]; ++i) {
    sum += a[i];
  }
  cout << (ans[sum][0] / all(n, k)).n << '\n';
}
