#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e2 + 1;
const int md = 1e9 + 7;
void inc(int &x, int y) { x = x + y >= md ? x + y - md : x + y; }
int len;
struct Mat {
  int a[maxn][maxn];
  Mat() { memset(a, 0, sizeof(a)); }
  Mat operator*(const Mat &x) const {
    Mat res = Mat();
    for (int i = 0; i <= len; ++i)
      for (int j = 0; j <= len; ++j)
        for (int k = 0; k <= len; ++k)
          inc(res.a[i][j], 1ll * a[i][k] * x.a[k][j] % md);
    return res;
  }
  void print() {
    for (int i = 0; i <= len; ++i, cout << endl)
      for (int j = 0; j <= len; ++j) cout << a[i][j] << " ";
  }
} res, mp;
int qpow(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = res * a % md;
    a = a * a % md;
    b >>= 1;
  }
  return res;
}
void qpow(int k) {
  while (k) {
    if (k & 1) res = res * mp;
    mp = mp * mp;
    k >>= 1;
  }
}
int n, k, a[maxn];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; ++i) scanf("%d", a + i), len += a[i] == 1;
  int now = 0;
  for (int i = n - len + 1; i <= n; ++i) now += a[i] == 1;
  res.a[0][now] = 1;
  for (int i = 0; i <= len; ++i) {
    mp.a[i][i - 1] = i * (n - len * 2 + i);
    mp.a[i][i + 1] = (len - i) * (len - i);
    mp.a[i][i] =
        (n * (n - 1) >> 1) - i * (n - len * 2 + i) - (len - i) * (len - i);
  }
  qpow(k);
  printf("%I64d\n", ((long long)res.a[0][len] *
                         qpow(qpow(n * (n - 1) >> 1, md - 2), k) % md +
                     md) %
                        md);
}
