#include <bits/stdc++.h>
void err() { std::cout << std::endl; }
template <typename T, typename... Args>
void err(T a, Args... args) {
  std::cout << a << ' ';
  err(args...);
}
using namespace std;
const int mod = 1e9 + 7;
const int inf = 1 << 30;
const int maxn = 100 + 5;
long long qpow(long long x, long long n) {
  long long r = 1;
  while (n > 0) {
    if (n & 1) r = r * x % mod;
    n >>= 1;
    x = x * x % mod;
  }
  return r;
}
long long inv(long long x) { return qpow(x, mod - 2); }
void add(long long& x, long long y) {
  x += y;
  if (x >= mod) x -= mod;
}
struct Mat {
  static const int M = 100 + 5;
  long long a[M][M];
  Mat() { memset(a, 0, sizeof(a)); }
  void clear() { memset(a, 0, sizeof(a)); }
  void eye() {
    for (int i = 0; i < M; i++) a[i][i] = 1;
  }
  long long* operator[](long long x) { return a[x]; }
  const long long* operator[](long long x) const { return a[x]; }
  Mat operator*(const Mat& b) {
    const Mat& a = *this;
    Mat r;
    for (int i = 0; i < M; i++)
      for (int j = 0; j < M; j++)
        for (int k = 0; k < M; k++)
          r[i][j] = (r[i][j] + a[i][k] * b[k][j]) % mod;
    return r;
  }
  Mat pow(long long n) const {
    Mat a = *this, r;
    r.eye();
    while (n > 0) {
      if (n & 1) r = r * a;
      n >>= 1;
      a = a * a;
    }
    return r;
  }
  Mat operator+(const Mat& b) {
    const Mat& a = *this;
    Mat r;
    for (int i = 0; i < M; i++)
      for (int j = 0; j < M; j++) r[i][j] = (a[i][j] + b[i][j]) % mod;
    return r;
  }
  void print() const {
    for (int i = 0; i < M; i++)
      for (int j = 0; j < M; j++)
        printf("%lld%c", (*this)[i][j], j == M - 1 ? '\n' : ' ');
  }
} F, T;
int n, k, m, a[maxn];
long long dp[2][maxn];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", a + i);
    if (a[i] == 0) m++;
  }
  int c = 0;
  for (int i = 1; i <= m; i++)
    if (a[i] == 0) c++;
  F[c][0] = 1;
  long long iv = inv(n * (n - 1) / 2), c1 = m * (m - 1) / 2,
            c2 = (n - m) * (n - m - 1) / 2;
  for (int i = 0; i <= m; i++) {
    T[i][i] =
        1ll * (c1 + c2 + i * (m - i) + (m - i) * (n - 2 * m + i)) * iv % mod;
    if (i > 0) {
      T[i][i - 1] = 1ll * (m - i + 1) * (m - i + 1) * iv % mod;
    }
    if (i < m) {
      T[i][i + 1] = 1ll * (i + 1) * (n - 2 * m + i + 1) * iv % mod;
    }
  }
  cout << (T.pow(k) * F)[m][0] << endl;
  return 0;
}
