#include <bits/stdc++.h>
using namespace std;
long long dp[10002][103];
long long n;
long long power(long long x, long long k) {
  long long result = 1;
  while (k) {
    if (k & 1) result = (result * x) % 1000000007;
    x = (x * x) % 1000000007;
    k = k >> 1;
  }
  return result;
}
class matrix {
 public:
  long long X[105][105] = {};
  matrix operator*(matrix& P) {
    matrix R;
    for (int i = 0; i <= n; i++) {
      for (int j = 0; j <= n; j++) {
        for (int k = 0; k <= n; k++) {
          R.X[i][k] = (R.X[i][k] + 1ll * X[i][j] * P.X[j][k]) % 1000000007;
        }
      }
    }
    return R;
  }
  matrix operator^(long long e) {
    if (e == 1) {
      return *this;
    }
    matrix T = *this ^ (e / 2);
    T = T * T;
    return e % 2 ? T * *this : T;
  }
} T;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL), cout.tie(NULL);
  long long i, j, k, c = 0;
  cin >> n >> k;
  long long a[n + 5], p;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] == 0) c++;
  }
  long long s = 0;
  for (i = 0; i < c; i++)
    if (a[i] == 0) s++;
  for (i = 0; i < c + 1; i++)
    for (j = 0; j < c + 1; j++) {
      T.X[i][j] = 0;
    }
  for (j = 0; j < c + 1; j++) {
    T.X[j][j] = ((n - c) * (n - c - 1) / 2 + c * (c - 1) / 2 +
                 (c - j) * (n - 2 * c + j) + j * (c - j)) %
                1000000007;
    if (j != 0) T.X[j][j - 1] = ((c - j + 1) * (c - j + 1)) % 1000000007;
    if (j != c) T.X[j][j + 1] = ((j + 1) * (n - 2 * c + j + 1)) % 1000000007;
  }
  matrix A = T ^ k;
  p = A.X[c][s];
  j = n * (n - 1) / 2;
  long long q = power(j, k);
  q = power(q, 1000000007 - 2);
  long long ans = p * q;
  ans = ans % 1000000007;
  cout << ans;
}
