#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int a[105], n, K, sn;
struct Mat {
  int a[105][105];
  Mat() { memset(a, 0, sizeof(a)); }
  Mat operator*(const Mat &b) const {
    Mat c = Mat();
    for (int i = 0; i <= sn; i++)
      for (int j = 0; j <= sn; j++)
        for (int k = 0; k <= sn; k++)
          c.a[i][j] = (c.a[i][j] + (long long)a[i][k] * b.a[k][j]) % mod;
    return c;
  }
} ret, mp;
int q_pow(int x, int n) {
  int ret = 1;
  for (; n; n >>= 1, x = (long long)x * x % mod)
    if (n & 1) ret = (long long)ret * x % mod;
  return ret;
}
void q_pow(int K) {
  for (; K; K >>= 1, mp = mp * mp)
    if (K & 1) ret = ret * mp;
}
int main() {
  scanf("%d%d", &n, &K);
  int now = 0;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), sn += a[i] == 1;
  for (int i = n - sn + 1; i <= n; i++) now += a[i] == 1;
  ret.a[0][now] = 1;
  for (int i = 0; i <= sn; i++) {
    mp.a[i][i - 1] = i * (n - sn * 2 + i);
    mp.a[i][i + 1] = (sn - i) * (sn - i);
    mp.a[i][i] =
        (n * (n - 1) >> 1) - i * (n - sn * 2 + i) - (sn - i) * (sn - i);
  }
  q_pow(K);
  printf("%I64d\n", ((long long)ret.a[0][sn] *
                         q_pow(q_pow(n * (n - 1) >> 1, mod - 2), K) % mod +
                     mod) %
                        mod);
}
