#include <bits/stdc++.h>
using namespace std;
const long long M = 1000000007;
long long mul(long long a, long long b) { return a * b % M; }
long long Pow(long long a, long long b) {
  long long x = 1;
  for (; b > 0; b >>= 1) {
    if (b & 1) x = mul(x, a);
    a = mul(a, a);
  }
  return x;
}
vector<vector<long long>> eye(int n) {
  vector<vector<long long>> I(n, vector<long long>(n));
  for (int i = 0; i < n; ++i) I[i][i] = 1;
  return I;
}
long long add(long long a, long long b) { return (a + b) % M; }
vector<vector<long long>> muli(vector<vector<long long>> &A,
                               vector<vector<long long>> &B) {
  int l = A.size(), m = B.size(), n = B[0].size();
  vector<vector<long long>> C(l, vector<long long>(n));
  for (int i = 0; i < l; ++i)
    for (int k = 0; k < m; ++k)
      for (int j = 0; j < n; ++j) C[i][j] = add(C[i][j], mul(A[i][k], B[k][j]));
  return C;
}
vector<vector<long long>> pow(vector<vector<long long>> A, long long b) {
  vector<vector<long long>> X = eye(A.size());
  for (; b > 0; b >>= 1) {
    if (b & 1) X = muli(X, A);
    A = muli(A, A);
  }
  return X;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  int t = 0;
  for (auto &i : a) cin >> i, t += i == 0;
  int cur = 0;
  for (int i = 0; i < t; ++i) cur += a[i] > 0;
  vector<vector<long long>> m(t + 1, vector<long long>(t + 1));
  long long tot = (n - 1) * n / 2;
  for (int i = 0; i <= t; ++i)
    for (int j = 0; j <= t; ++j) {
      if (j - 1 == i) m[i][j] = j * j % M * Pow(tot, M - 2) % M;
      if (j + 1 == i) m[i][j] = (t - j) * (n - t - j) % M * Pow(tot, M - 2) % M;
      if (j == i)
        m[i][j] = (tot - (j * j % M + (t - j) * (n - t - j) % M) % M + M) % M *
                  Pow(tot, M - 2) % M;
    }
  m = pow(m, k);
  cout << m[0][cur] << "\n";
  return 0;
}
