#include <bits/stdc++.h>
using namespace std;
const int N = 105, MOD = 1e9 + 7;
struct mat {
  int a[N][N];
  mat() { memset(a, 0, sizeof(a)); }
};
int n, cnt[2];
mat operator*(const mat &a, const mat &b) {
  mat c = mat();
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      for (int k = 0; k < n; ++k) {
        (c.a[i][k] += 1LL * a.a[i][j] * b.a[j][k] % MOD) %= MOD;
      }
    }
  }
  return c;
}
mat pow(mat x, int m) {
  mat res = mat();
  for (int i = 0; i < n; ++i) res.a[i][i] = 1;
  while (m) {
    if (m & 1) res = res * x;
    x = x * x;
    m >>= 1;
  }
  return res;
}
int npow(int x, int m) {
  int res = 1;
  while (m) {
    if (m & 1) res = 1LL * res * x % MOD;
    x = 1LL * x * x % MOD;
    m >>= 1;
  }
  return res;
}
int a[N];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
    cnt[a[i]]++;
  }
  int x0 = 0;
  for (int i = n - cnt[1]; i < n; ++i) {
    x0 += (a[i] == 1);
  }
  mat p0 = mat();
  p0.a[0][x0] = 1;
  int ans = npow(npow(n * (n - 1) / 2, m), MOD - 2);
  mat p = mat();
  ::n = cnt[1] + 1;
  for (int i = 0; i <= cnt[1]; ++i) {
    vector<int> x = {i, cnt[1] - i, cnt[1] - i, cnt[0] - cnt[1] + i};
    for (int a = 0; a < 4; ++a) {
      for (int b = a + 1; b < 4; ++b) {
        int j = i;
        if (a == 0 && b == 3) j--;
        if (a == 1 && b == 2) j++;
        if (j >= 0 && j <= cnt[1]) (p.a[i][j] += x[a] * x[b]) %= MOD;
      }
      (p.a[i][i] += x[a] * (x[a] - 1) / 2) %= MOD;
    }
  }
  mat res = p0 * pow(p, m);
  ans = 1LL * res.a[0][cnt[1]] * ans % MOD;
  printf("%d\n", ans);
}
