#include <bits/stdc++.h>
using namespace std;
const int N = 100 + 5, MOD = 1e9 + 7;
long long fact[N], fact_inv[N];
long long mul(long long a, long long b) { return a * b % MOD; }
long long add(long long a, long long b) { return (a + b) % MOD; }
long long power(long long a, long long b) {
  if (!b) return 1;
  long long r = power(a, b / 2);
  r = mul(r, r);
  if (b & 1) return mul(r, a);
  return r;
}
long long mod_inv(long long x) { return power(x, MOD - 2); }
long long nCr(long long n, long long r) {
  if (!r) return 1;
  if (r > n) return 0;
  return mul(fact[n], mul(fact_inv[n - r], fact_inv[r]));
}
void pre() {
  fact[0] = fact_inv[0] = 1;
  for (int i = 1; i < N; i++) {
    fact[i] = mul(fact[i - 1], i);
    fact_inv[i] = mod_inv(fact[i]);
  }
}
using row = vector<long long>;
using mat = vector<row>;
mat operator*(const mat &a, const mat &b) {
  mat ret = mat(a.size(), row(b[0].size()));
  for (int i = 0; i < ret.size(); i++)
    for (int j = 0; j < ret[i].size(); j++)
      for (int k = 0; k < ret[i].size(); k++)
        ret[i][j] = add(ret[i][j], mul(a[i][k], b[k][j]));
  return ret;
}
mat operator^(mat a, long long b) {
  mat ans(a.size(), row(a[0].size()));
  for (int i = 0; i < a.size(); i++) ans[i][i] = 1;
  for (; b; b >>= 1, a = a * a)
    if (b & 1) ans = ans * a;
  return ans;
}
int pairs(int n) { return mul(n, mul(n - 1, mod_inv(2))); }
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  pre();
  int n, k;
  cin >> n >> k;
  int cnt[2] = {};
  vector<int> A(n);
  for (auto &a : A) {
    cin >> a;
    cnt[a]++;
  }
  int all = mod_inv(pairs(n));
  mat p(cnt[1] + 1, row(cnt[1] + 1, 0));
  for (int good1 = 0; good1 <= cnt[1]; good1++) {
    int bad1 = cnt[1] - good1;
    int bad0 = bad1;
    int good0 = cnt[0] - bad0;
    int same = add(pairs(cnt[1]), pairs(cnt[0]));
    same = add(same, add(mul(good1, bad0), mul(bad1, good0)));
    int plus = mul(bad1, bad0);
    int minus = mul(good1, good0);
    p[good1][good1] = mul(same, all);
    if (good1) p[good1][good1 - 1] = mul(minus, all);
    if (good1 + 1 <= cnt[1]) p[good1][good1 + 1] = mul(plus, all);
  }
  auto B = A;
  sort(B.begin(), B.end());
  int good = 0;
  for (int i = 0; i < n; i++) good += A[i] == B[i] && B[i] == 1;
  p = p ^ k;
  cout << p[good][cnt[1]];
}
