#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
long long add(long long a, long long b) { return (a + b) % mod; }
long long mul(long long a, long long b) { return a * b % mod; }
long long qpow(long long a, long long b = mod - 2) {
  long long ret = 1;
  while (b) {
    if (b & 1) ret = mul(ret, a);
    a = mul(a, a);
    b >>= 1;
  }
  return ret;
}
const int maxm = 105, inv_2 = qpow(2);
long long C(long long a) { return mul(inv_2, mul(a, add(a, mod - 1))); }
int n, k, len_a, len_b;
int num[maxm];
struct matrix {
  long long num[maxm][maxm];
};
matrix mul(matrix a, matrix b) {
  matrix c;
  memset(c.num, 0, sizeof(c.num));
  for (int i = 0; i <= len_b; i++)
    for (int j = 0; j <= len_b; j++)
      if (a.num[i][j])
        for (int k = 0; k <= len_b; k++)
          c.num[i][k] = add(c.num[i][k], mul(a.num[i][j], b.num[j][k]));
  return c;
}
matrix qpow(matrix a, long long b) {
  matrix e;
  for (int i = 0; i <= len_b; i++)
    for (int j = 0; j <= len_b; j++) e.num[i][j] = (i == j);
  while (b) {
    if (b & 1) e = mul(e, a);
    a = mul(a, a);
    b >>= 1;
  }
  return e;
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", num + i);
    if (num[i])
      len_b++;
    else
      len_a++;
  }
  matrix base;
  for (int i = 0; i <= len_b; i++) {
    for (int j = max(0, i - 1); j <= min(len_b, i + 1); j++) {
      int b1 = j, b0 = len_b - j, a0 = len_a - b0, a1 = len_a - a0;
      if (i == j - 1)
        base.num[i][j] = a0 * b1;
      else if (i == j + 1)
        base.num[i][j] = a1 * b0;
      else {
        base.num[i][j] = add(base.num[i][j], C(a0));
        base.num[i][j] = add(base.num[i][j], C(a1));
        base.num[i][j] = add(base.num[i][j], C(b0));
        base.num[i][j] = add(base.num[i][j], C(b1));
        base.num[i][j] = add(base.num[i][j], mul(a0, a1));
        base.num[i][j] = add(base.num[i][j], mul(a0, b0));
        base.num[i][j] = add(base.num[i][j], mul(a1, b1));
        base.num[i][j] = add(base.num[i][j], mul(b0, b1));
      }
    }
  }
  int cnt = 0;
  for (int i = len_a; i < n; i++)
    if (num[i]) cnt++;
  matrix ano;
  memset(ano.num, 0, sizeof(ano.num));
  ano.num[cnt][0] = 1;
  base = mul(qpow(base, k), ano);
  long long ans = base.num[len_b][0];
  ans = mul(ans, qpow(qpow(C(n), k)));
  printf("%lld\n", ans);
  return 0;
}
