#include <bits/stdc++.h>
using namespace std;
namespace debug {
template <class T1, class T2>
void pr(const pair<T1, T2> &x);
template <class T, size_t SZ>
void pr(const array<T, SZ> &x);
template <class T>
void pr(const vector<T> &x);
template <class T>
void pr(const set<T> &x);
template <class T1, class T2>
void pr(const map<T1, T2> &x);
template <class T>
void pr(const T &x) {
  cout << x;
}
template <class T, class... Ts>
void pr(const T &first, const Ts &...rest) {
  pr(first), pr(rest...);
}
template <class T1, class T2>
void pr(const pair<T1, T2> &x) {
  pr("{", x.first, ", ", x.second, "}");
}
template <class T>
void prIn(const T &x) {
  pr("{");
  bool fst = 1;
  for (auto &a : x) {
    pr(fst ? "" : ", ", a), fst = 0;
  }
  pr("}");
}
template <class T, size_t SZ>
void pr(const array<T, SZ> &x) {
  prIn(x);
}
template <class T>
void pr(const vector<T> &x) {
  prIn(x);
}
template <class T>
void pr(const set<T> &x) {
  prIn(x);
}
template <class T1, class T2>
void pr(const map<T1, T2> &x) {
  prIn(x);
}
void ps() { pr("\n"); }
template <class Arg, class... Args>
void ps(const Arg &first, const Args &...rest) {
  pr(first, " ");
  ps(rest...);
}
}  // namespace debug
using namespace debug;
const int MOD = 1000000007;
namespace binexp {
long long bPow(long long b, long long p = MOD - 2) {
  b %= MOD;
  long long c = 1;
  while (p) {
    if (p & 1) {
      c = c * b % MOD;
    }
    b = b * b % MOD;
    p >>= 1;
  }
  return c;
}
}  // namespace binexp
using namespace binexp;
int N, K;
int a[105];
long long mat[105][105];
void mult(long long a[105][105], long long b[105][105],
          long long res[105][105]) {
  memset(res, 0, 8 * 105 * 105);
  for (int i = 0; i < 105; i++) {
    for (int j = 0; j < 105; j++) {
      for (int k = 0; k < 105; k++) {
        res[i][j] = (res[i][j] + a[i][k] * b[k][j]) % MOD;
      }
    }
  }
}
long long exp(int p, int x, int y) {
  long long c[105][105];
  memset(c, 0, sizeof(c));
  for (int i = 0; i < 105; i++) {
    c[i][i] = 1;
  }
  long long b[105][105];
  memcpy(b, mat, sizeof(mat));
  long long tmp[105][105];
  while (p > 0) {
    if (p & 1) {
      mult(c, b, tmp);
      memcpy(c, tmp, sizeof(tmp));
    }
    mult(b, b, tmp);
    memcpy(b, tmp, sizeof(tmp));
    p >>= 1;
  }
  return c[x][y];
}
int main() {
  cin >> N >> K;
  int cnt = 0;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    if (a[i] == 0) {
      cnt++;
    }
  }
  int oo = 0;
  for (int i = 0; i < cnt; i++) {
    if (a[i] == 1) {
      oo++;
    }
  }
  memset(mat, 0, sizeof(mat));
  for (int i = 0; i <= min(cnt, N - cnt); i++) {
    if (i + 1 <= N) {
      mat[i][i + 1] = 1LL * (cnt - i) * (N - cnt - i) % MOD;
    }
    if (i - 1 >= 0) {
      mat[i][i - 1] = 1LL * i * i % MOD;
    }
    mat[i][i] = (1LL * cnt * (cnt - 1) / 2) % MOD;
    mat[i][i] = (mat[i][i] + 1LL * (N - cnt) * (N - cnt - 1) / 2) % MOD;
    mat[i][i] = (mat[i][i] + 1LL * i * (N - cnt - i)) % MOD;
    mat[i][i] = (mat[i][i] + 1LL * (cnt - i) * (i)) % MOD;
  }
  long long num = exp(K, oo, 0);
  long long ch2 = (N * (N - 1LL) / 2) % MOD;
  long long den = bPow(ch2, K);
  long long iDen = bPow(den);
  cout << num * iDen % MOD << endl;
}
