#include <bits/stdc++.h>
using namespace std;
const long long p = (long long)1e9 + 7;
int n, m, k, a[110];
long long f[110][110], C[110][110];
long long qmod(long long base, long long n) {
  long long res = 1;
  while (n) {
    if (n & 1) {
      res = res * base % p;
    }
    base = base * base % p;
    n >>= 1;
  }
  return res;
}
struct node {
  int len;
  long long a[110][110];
  node() {}
  node(int len) {
    this->len = len;
    memset(a, 0, sizeof a);
  }
  node operator*(const node &other) const {
    node res = node(len);
    for (int i = 0; i <= len; ++i) {
      for (int j = 0; j <= len; ++j) {
        for (int k = 0; k <= len; ++k) {
          (res.a[i][j] += a[i][k] * other.a[k][j] % p) %= p;
        }
      }
    }
    return res;
  }
} base, res;
void qmod(node &res, node &base, long long n) {
  while (n) {
    if (n & 1) {
      res = res * base;
    }
    base = base * base;
    n >>= 1;
  }
}
int main() {
  memset(C, 0, sizeof C);
  C[1][0] = C[1][1] = 1;
  for (int i = 1; i <= 100; ++i) {
    for (int j = 0; j <= i; ++j) {
      (C[i + 1][j + 1] += C[i][j]) %= p;
      (C[i + 1][j] += C[i][j]) %= p;
    }
  }
  while (scanf("%d%d", &n, &k) != EOF) {
    m = 0;
    for (int i = 1; i <= n; ++i) {
      scanf("%d", a + i);
      m += (a[i] == 0);
    }
    base = node(m);
    res = node(m);
    if (m == 0) {
      res.a[0][0] = 1;
    }
    for (int i = 1, j = 0; i <= m; ++i) {
      j += (a[i] == 1);
      if (i == m) {
        res.a[0][j] = 1;
      }
    }
    for (int i = 0; i <= m; ++i) {
      (base.a[i][i] += C[m][2] + C[n - m][2]) %= p;
      (base.a[i][i] += i * (n - m - i) % p) %= p;
      (base.a[i][i] += (m - i) * i % p) %= p;
      if (i != 0) {
        (base.a[i - 1][i] += (m - i + 1) * (n - m - i + 1) % p) %= p;
      }
      if (i != m) {
        (base.a[i + 1][i] += (i + 1) * (i + 1) % p) %= p;
      }
    }
    qmod(res, base, k);
    long long a = res.a[0][0], b = 0;
    for (int i = 0; i <= m; ++i) {
      (b += res.a[0][i]) %= p;
    }
    printf("%lld\n", a * qmod(b, p - 2) % p);
  }
  return 0;
}
