#include <bits/stdc++.h>
using namespace std;
long long mpow(long long x, long long y, long long m) {
  long long res = 1;
  while (y > 0) {
    if (y & 1) res = res * x % m;
    y = y >> 1;
    x = x * x % m;
  }
  return res;
}
long long sz;
const long long M = 100;
long long mat[100][100], fin[100][100];
void mult1() {
  long long temp[sz][sz];
  memset(temp, 0, sizeof(temp));
  for (long long i = (0); i < (sz); i++) {
    for (long long j = (0); j < (sz); j++) {
      for (long long k = (0); k < (sz); k++)
        temp[i][j] += mat[i][k] * mat[k][j] % 1000000007;
      temp[i][j] %= 1000000007;
    }
  }
  for (long long i = (0); i < (sz); i++) {
    for (long long j = (0); j < (sz); j++) mat[i][j] = temp[i][j];
  }
}
void mult2() {
  long long temp[sz][sz];
  memset(temp, 0, sizeof(temp));
  for (long long i = (0); i < (sz); i++) {
    for (long long j = (0); j < (sz); j++) {
      for (long long k = (0); k < (sz); k++)
        temp[i][j] += fin[i][k] * mat[k][j] % 1000000007;
      temp[i][j] %= 1000000007;
    }
  }
  for (long long i = (0); i < (sz); i++) {
    for (long long j = (0); j < (sz); j++) fin[i][j] = temp[i][j];
  }
}
void matexp(long long p) {
  while (p != 0) {
    if (p & 1) mult2();
    mult1();
    p >>= 1;
  }
}
void solve() {
  long long n, k;
  cin >> n >> k;
  long long a[n];
  for (long long i = (0); i < (n); i++) cin >> a[i];
  long long ones = 0;
  for (long long i = (0); i < (n); i++) {
    if (a[i] == 1) ones++;
  }
  long long w = ones <= n / 2 ? 0 : ones - (n - ones);
  sz = ones - w + 1;
  long long tcb = n * (n - 1) / 2;
  for (long long i = (0); i < (sz); i++) {
    mat[i][i] = tcb - w * (n + w - 2 * ones) - (ones - w) * (ones - w);
    if (i != 0) mat[i][i - 1] = (ones - w + 1) * (ones - w + 1);
    if (i != sz - 1) mat[i][i + 1] = (w + 1) * (n + w + 1 - 2 * ones);
    w++;
  }
  for (long long i = (0); i < (sz); i++) fin[i][i] = 1;
  matexp(k);
  w = ones <= n / 2 ? 0 : ones - (n - ones);
  long long x = 0;
  for (long long i = (n - 1); i > (n - ones - 1); i--) {
    if (a[i] == 1) x++;
  }
  long long num = fin[sz - 1][x - w], den = mpow(tcb, k, 1000000007);
  cout << num * mpow(den, 1000000007 - 2, 1000000007) % 1000000007;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  for (long long i = (1); i < (t + 1); i++) {
    solve();
    cout << "\n";
  }
}
