#include <bits/stdc++.h>
using namespace std;
template <typename T>
void out(T x) {
  cout << x << endl;
  exit(0);
}
using ll = long long;
const ll mod = 1e9 + 7;
const int maxn = 110;
using matrix = vector<vector<ll>>;
void add(ll& x, ll y) {
  if (x >= mod) x %= mod;
  if (y >= mod) y %= mod;
  x += y;
  if (x >= mod) x %= mod;
}
void mul(ll& x, ll y) {
  if (x >= mod) x %= mod;
  if (y >= mod) y %= mod;
  x += y;
  if (x >= mod) x %= mod;
}
matrix mul(matrix a, matrix b) {
  int n = a.size();
  assert(n > 0);
  int m = a[0].size();
  assert(m == int(b.size()));
  int p = b[0].size();
  matrix res(n, vector<ll>(p));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < p; j++) {
      for (int k = 0; k < m; k++) {
        ll cur = a[i][k] * b[k][j] % mod;
        add(res[i][j], cur);
      }
    }
  }
  return res;
}
matrix matpw(matrix mat, ll k) {
  int n = mat.size();
  assert(mat.size() && mat.size() == mat[0].size());
  matrix res(n, vector<ll>(n));
  for (int i = 0; i < n; i++) {
    res[i][i] = 1;
  }
  while (k > 0) {
    if (k % 2) {
      res = mul(res, mat);
    }
    mat = mul(mat, mat);
    k = k / 2;
  }
  return res;
}
ll pw(ll x, ll y) {
  ll res = 1;
  while (y) {
    if (y % 2) res = res * x % mod;
    x = x * x % mod;
    y = y / 2;
  }
  return ((res % mod) + mod) % mod;
}
int n, k;
int a[maxn];
ll dp[maxn][maxn];
int cnt[2];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    cnt[a[i]]++;
  }
  int zero = cnt[0];
  int have = 0;
  for (int i = 0; i < zero; i++) {
    have += (a[i] == 0);
  }
  matrix M = vector<vector<ll>>(zero + 1, vector<ll>(zero + 1, 0));
  for (int j = 0; j <= zero; j++) {
    ll ways = 1ll * n * (n - 1) / 2;
    ll inc = (cnt[0] - j) * (cnt[0] - j);
    ll dec = j * (cnt[1] - (cnt[0] - j));
    ll noop = ways - inc - dec;
    ll den = pw(ways, mod - 2);
    if (j > 0) {
      M[j][j - 1] = dec * den % mod;
    }
    if (j < zero) {
      M[j][j + 1] = inc * den % mod;
    }
    M[j][j] = noop * den % mod;
  }
  M = matpw(M, k);
  cout << M[have][zero] << endl;
  return 0;
  dp[0][have] = 1;
  for (int i = 0; i < k; i++) {
    for (int j = 0; j <= zero; j++) {
      if (dp[i][j] == 0) continue;
      ll ways = 1ll * n * (n - 1) / 2;
      ll inc = (cnt[0] - j) * (cnt[0] - j);
      ll dec = j * (cnt[1] - (cnt[0] - j));
      ll noop = ways - inc - dec;
      assert(noop >= 0);
      ll den = pw(ways, mod - 2);
      if (j > 0) {
        dp[i + 1][j - 1] += dp[i][j] * dec % mod * den % mod;
        dp[i + 1][j - 1] %= mod;
      }
      if (j < zero) {
        dp[i + 1][j + 1] += dp[i][j] * inc % mod * den % mod;
        dp[i + 1][j + 1] %= mod;
      }
      dp[i + 1][j] += dp[i][j] * noop % mod * den % mod;
      dp[i + 1][j] %= mod;
    }
  }
  cout << dp[k][cnt[0]] << endl;
  return 0;
}
