#include <bits/stdc++.h>
using namespace std;
const int N = 1e2 + 5;
const long long MOD = 1e9 + 7;
int a[N];
struct Matrix {
  long long a[N][N];
};
long long fpow(long long a, long long b) {
  long long rtn = 1;
  while (b) {
    if (b & 1) rtn = (rtn * a) % MOD;
    b >>= 1;
    a = (a * a) % MOD;
  }
  return rtn;
}
void mmul(Matrix& a, Matrix b, int n) {
  Matrix rtn;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      rtn.a[i][j] = 0;
      for (int k = 0; k < n; ++k)
        rtn.a[i][j] = (rtn.a[i][j] + a.a[i][k] * b.a[k][j] % MOD) % MOD;
    }
  }
  a = rtn;
}
void mfpow(Matrix& mat, int k, int n) {
  Matrix rtn;
  for (int i = 0; i < n; ++i) {
    rtn.a[i][i] = 1;
  }
  while (k) {
    if (k & 1) mmul(rtn, mat, n);
    mmul(mat, mat, n);
    k >>= 1;
  }
  mat = rtn;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  int n1 = 0, WA = 0;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    if (a[i]) n1++;
  }
  for (int i = 0; i < n; ++i) {
    if (i < n - n1 && a[i]) WA++;
  }
  int n0 = n - n1;
  long long invc = fpow(1LL * n * (n - 1) / 2, MOD - 2);
  int top = min(n1, n0);
  Matrix mat;
  for (int i = 0; i <= top; ++i) {
    long long pre = 0;
    for (int j = 0; j <= top; ++j) {
      if (i == j + 1) {
        pre += 1LL * (n0 - i + 1) * (n1 - i + 1);
        mat.a[i][j] = 1LL * (n0 - i + 1) * (n1 - i + 1) * invc % MOD;
      } else if (i == j - 1) {
        pre += 1LL * (i + 1) * (i + 1);
        mat.a[i][j] = 1LL * (i + 1) * (i + 1) * invc % MOD;
      }
    }
    mat.a[i][i] =
        1LL * (n * (n - 1) / 2 - i * i - (n0 - i) * (n1 - i)) * invc % MOD;
  }
  mfpow(mat, k, top + 1);
  cout << mat.a[0][WA] << endl;
  return 0;
}
