#include <bits/stdc++.h>
#pragma GCC optimize(3, "Ofast", "inline")
using namespace std;
const int Mod = 1e9 + 7;
struct Matrix {
  int n, m, a[146][146];
  Matrix(int _n = 0, int _m = 0, int x = 0) {
    n = _n, m = _m;
    memset(a, 0, sizeof a);
    for (int i = 0; i < min(n, m); ++i) a[i][i] = x;
  }
  Matrix operator*(const Matrix& b) {
    Matrix res = Matrix(n, b.m);
    for (int i = 0; i < n; ++i)
      for (int j = 0; j < m; ++j)
        if (a[i][j])
          for (int k = 0; k < b.m; ++k)
            (res.a[i][k] += 1ll * a[i][j] * b.a[j][k] % Mod) %= Mod;
    return res;
  }
  Matrix operator^(int p) {
    Matrix res = Matrix(n, n, 1), x = *this;
    while (p) {
      if (p & 1) res = res * x;
      x = x * x;
      p >>= 1;
    }
    return res;
  }
};
inline int fsp(int x, int p = Mod - 2) {
  int res = 1;
  while (p) {
    if (p & 1) res = 1ll * res * x % Mod;
    x = 1ll * x * x % Mod;
    p >>= 1;
  }
  return res;
}
int n, m, cnt, tmp, a[146];
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) {
    scanf("%d", a + i);
    if (!a[i]) ++cnt;
  }
  for (int i = 1; i <= cnt; ++i) tmp += a[i] ^ 1;
  Matrix base = Matrix(cnt + 1, cnt + 1), res;
  for (int i = 0; i <= cnt; ++i) {
    if (i < cnt) base.a[i + 1][i] += (cnt - i) * (cnt - i);
    base.a[i][i] += cnt * (cnt - 1) / 2 + (n - cnt) * (n - cnt - 1) / 2 +
                    i * (cnt - i) + (cnt - i) * (n + i - 2 * cnt);
    if (i) base.a[i - 1][i] += i * (n + i - 2 * cnt);
  }
  res = base ^ m;
  long long ans = 0;
  for (int i = 0; i <= cnt; ++i) (ans += res.a[i][tmp]) %= Mod;
  cout << 1ll * res.a[cnt][tmp] * fsp(ans) % Mod << endl;
  return 0;
}
