#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 3) + (x << 1) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
const long long N = 107, MOD = 1e9 + 7;
long long n, K, c;
bool s[N];
struct Mat {
  long long val[N][N];
  long long Max_n, Max_m;
  Mat() {
    memset(val, 0, sizeof(val));
    Max_n = Max_m = 0;
  }
  Mat operator*(const Mat el) const {
    Mat c;
    for (long long i = 0; i <= Max_n; ++i)
      for (long long j = 0; j <= el.Max_m; ++j)
        for (long long k = 0; k <= Max_m; ++k)
          c.val[i][j] =
              (c.val[i][j] + ((val[i][k] * el.val[k][j]) % MOD)) % MOD;
    c.Max_n = Max_n, c.Max_m = el.Max_m;
    return c;
  }
  inline void I(long long n) {
    Max_n = Max_m = n;
    for (long long i = 0; i <= n; ++i) val[i][i] = 1;
  }
};
inline long long power(long long x, long long y) {
  long long res = 1, base = x;
  while (y) {
    if (y & 1) res = (res * base) % MOD;
    base = (base * base) % MOD;
    y >>= 1;
  }
  return res;
}
signed main() {
  n = read(), K = read();
  for (long long i = 1; i <= n; ++i) s[i] = read(), c += (s[i] == 0);
  Mat A, F;
  long long t = 0;
  for (long long i = 1; i <= c; ++i)
    if (s[i] == 0) ++t;
  F.val[0][t] = 1;
  F.Max_n = 1, F.Max_m = c;
  for (long long i = 0; i <= c; ++i) {
    if (i != 0) A.val[i - 1][i] = (c - i + 1) * (c - i + 1);
    A.val[i][i] = (c * (c - 1) / 2) + ((n - c) * (n - c - 1) / 2) +
                  (i * (c - i)) + (c - i) * (n - c - c + i);
    if (i != c) A.val[i + 1][i] = (i + 1) * (n - c - c + i + 1);
  }
  A.Max_n = A.Max_m = c;
  long long y = K;
  Mat res;
  res.I(c);
  while (y) {
    if (y & 1) res = res * A;
    A = A * A;
    y >>= 1;
  }
  F = F * res;
  long long ans = F.val[0][c], sum = 0;
  for (long long i = 0; i <= c; ++i) sum = (sum + F.val[0][i]) % MOD;
  ans = (ans * power(sum, MOD - 2)) % MOD;
  printf("%lld\n", ans);
  return 0;
}
