#include <bits/stdc++.h>
using namespace std;
mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());
long long nn, MOD = 1e9 + 7;
vector<vector<long long> > matMul(vector<vector<long long> > &a,
                                  vector<vector<long long> > &b) {
  vector<vector<long long> > c(nn, vector<long long>(nn, 0));
  int k;
  for (int i = 0; i < nn; i++)
    for (int j = 0; j < nn; j++)
      for (k = 0; k < nn; k++) {
        c[i][j] += (a[i][k] % MOD) * (b[k][j] % MOD);
        c[i][j] %= MOD;
      }
  return c;
}
vector<vector<long long> > matPow(vector<vector<long long> > base,
                                  long long p) {
  vector<vector<long long> > ans(nn, vector<long long>(nn, 0));
  int i, j;
  for (i = 0; i < nn; i++)
    for (j = 0; j < nn; j++) ans[i][j] = (i == j);
  while (p) {
    if (p & 1) ans = matMul(ans, base);
    base = matMul(base, base);
    p >>= 1;
  }
  return ans;
}
inline long long pw(long long a, long long b) {
  if (b == 0) return 1;
  long long v = pw(a, b / 2);
  v = (v * v) % MOD;
  if (b & 1) v = (v * a) % MOD;
  return v;
}
int main() {
  ios::sync_with_stdio(0);
  int n, k;
  cin >> n >> k;
  vector<long long> al(n);
  for (auto &e : al) cin >> e;
  int toto = 0, totz, nowz = 0;
  for (long long i = 0; i < n; i++) toto += al[i];
  totz = n - toto;
  for (long long i = 0; i < totz; i++) nowz += al[i] == 0;
  vector<vector<long long> > mat(totz + 1, vector<long long>(totz + 1, 0));
  for (long long i = 0; i < totz + 1; i++) {
    if (toto < totz - i) continue;
    if (i && toto >= totz - (i - 1))
      mat[i - 1][i] = (totz - (i - 1)) * (totz - (i - 1));
    if (i < totz && toto >= totz - (i + 1))
      mat[i + 1][i] = (i + 1) * (toto - (totz - (i + 1)));
    mat[i][i] = ((totz * (totz - 1)) / 2 + (toto * (toto - 1) / 2)) % MOD;
    (mat[i][i] += i * (totz - i) + (totz - i) * (toto - (totz - i))) %= MOD;
  }
  nn = totz + 1;
  vector<vector<long long> > ans = matPow(mat, k);
  vector<vector<long long> > bse(totz + 1, vector<long long>(totz + 1, 0));
  bse[0][nowz] = 1;
  vector<vector<long long> > final = matMul(bse, ans);
  long long des = final[0][totz], total = 0;
  for (auto &x : final)
    for (auto &c : x) (total += c) %= MOD;
  cout << (des * pw(total, MOD - 2)) % MOD << endl;
  return 0;
}
