#include <bits/stdc++.h>
using namespace std;
const int N = 105, M = 1e9 + 7;
int n, k, a[N], ze;
struct mat {
  int mt[N][N];
  mat() { memset(mt, 0, sizeof(mt)); }
  mat operator*(const mat &t) const {
    mat ans;
    for (int i = 0; i <= ze; i++)
      for (int j = 0; j <= ze; j++)
        for (int k = 0; k <= ze; k++)
          ans.mt[i][j] = (1ll * mt[i][k] * t.mt[k][j] % M + ans.mt[i][j]) % M;
    return ans;
  }
} beg, ope, ans;
mat qpow(mat x, int y) {
  mat sum;
  for (int i = 0; i <= ze; i++) sum.mt[i][i] = 1;
  while (y) {
    if (y & 1) sum = sum * x;
    y >>= 1, x = x * x;
  }
  return sum;
}
int qpow(int x, int y) {
  int sum = 1;
  while (y) {
    if (y & 1) sum = 1ll * sum * x % M;
    y >>= 1, x = 1ll * x * x % M;
  }
  return sum;
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    ze += (a[i] == 0);
  }
  int lc = 0;
  for (int i = 1; i <= ze; i++) lc += (a[i] == 0);
  beg.mt[lc][0] = 1;
  for (int i = 0; i <= ze; i++) {
    ope.mt[i][i] = (1ll * ze * (ze - 1) / 2 +
                    1ll * (n - ze) * (n - ze - 1) / 2 + 1ll * i * (ze - i)) %
                   M;
    if (i >= 2 * ze - n)
      ope.mt[i][i] = (ope.mt[i][i] + 1ll * (ze - i) * (n - 2 * ze + i) % M) % M;
    if (i) ope.mt[i][i - 1] = 1ll * (ze - i + 1) * (ze - i + 1) % M;
    if (i != ze && n - 2 * ze + i + 1 >= 0)
      ope.mt[i][i + 1] = 1ll * (i + 1) * (n - 2 * ze + i + 1) % M;
  }
  ans = qpow(ope, k) * beg;
  int res = 0;
  for (int i = 0; i <= ze; i++) res = (res + ans.mt[i][0]) % M;
  res = 1ll * qpow(res, M - 2) * ans.mt[ze][0] % M;
  printf("%d\n", res);
  return 0;
}
