#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  char c = getchar();
  long long x = 0;
  bool f = 0;
  for (; !isdigit(c); c = getchar()) f ^= !(c ^ 45);
  for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
  if (f) x = -x;
  return x;
}
const long long Mod = 1e9 + 7;
const long long M = 110;
long long dp[M][M], n, k, t, a[M];
struct node {
  long long a[M][M];
} ans, aa, res;
node mul(node a, node b) {
  node c;
  memset(c.a, 0, sizeof(c.a));
  for (long long i = 0; i <= t; i++)
    for (long long j = 0; j <= t; j++)
      for (long long k = 0; k <= t; k++)
        c.a[i][j] = (c.a[i][j] + a.a[i][k] * b.a[k][j]) % Mod;
  return c;
}
long long poww(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = res * a % Mod;
    a = a * a % Mod, b >>= 1;
  }
  return res;
}
long long inv(long long a) { return poww(a, Mod - 2); }
node poww2(node a, long long b) {
  while (b) {
    if (b & 1) res = mul(res, a);
    a = mul(a, a), b >>= 1;
  }
  return res;
}
signed main() {
  n = read(), k = read();
  for (long long i = 1; i <= n; i++) a[i] = read(), t += a[i] ^ 1;
  long long cnt = 0;
  for (long long i = 1; i <= t; i++) cnt += a[i] ^ 1;
  ans.a[0][cnt] = 1;
  for (long long i = 0; i <= t; i++) res.a[i][i] = 1;
  for (long long i = 0; i <= t; i++)
    aa.a[i - 1][i] = (t - i + 1) * (t - i + 1) % Mod,
             aa.a[i][i] = (t * (t - 1) / 2 + (n - t) * (n - t - 1) / 2 +
                           i * (t - i) + (t - i) * (n - 2 * t + i)) %
                          Mod,
             aa.a[i + 1][i] = (i + 1) * (n - 2 * t + (i + 1)) % Mod;
  aa = poww2(aa, k);
  ans = mul(ans, aa);
  cout << ans.a[0][t] * inv(poww(n * (n - 1) / 2, k)) % Mod;
  return 0;
}
