#include <bits/stdc++.h>
using namespace std;
const long long N = 110;
const long long Mod = 1e9 + 7;
long long Fact[N];
long long add(long long x, long long y) {
  x %= Mod, y %= Mod;
  return (x + y) % Mod;
}
long long sub(long long x, long long y) {
  x %= Mod, y %= Mod;
  return (x - y + Mod) % Mod;
}
long long mul(long long x, long long y) {
  x %= Mod, y %= Mod;
  return x * y % Mod;
}
void add_self(long long& x, long long y) { x = add(x, y); }
void sub_self(long long& x, long long y) { x = sub(x, y); }
void mul_self(long long& x, long long y) { x = mul(x, y); }
long long fp(long long x, long long y) {
  if (!y) return 1;
  long long Res = fp(x, y / 2);
  mul_self(Res, Res);
  if (y & 1) mul_self(Res, x);
  return Res;
}
long long GCD(long long x, long long y) { return y ? GCD(y, x % y) : x; }
long long inv(long long y) { return fp(y, Mod - 2); }
long long inv(long long x, long long y) { return mul(x, inv(y)); }
long long C(long long n, long long r) {
  if (n < 0 || r < 0 || n < r) return 0;
  return inv(Fact[n], mul(Fact[r], Fact[n - r]));
}
vector<vector<long long> > Zero(long long n, long long m) {
  return vector<vector<long long> >(n, vector<long long>(m, 0));
}
vector<vector<long long> > Identity(long long n) {
  vector<vector<long long> > Res = Zero(n, n);
  for (long long i = 0; i < n; i++) Res[i][i] = 1;
  return Res;
}
vector<vector<long long> > Muliply(const vector<vector<long long> >& A,
                                   const vector<vector<long long> >& B) {
  vector<vector<long long> > Res = Zero(A.size(), B[0].size());
  for (long long i = 0; i < A.size(); i++)
    for (long long k = 0; k < B.size(); k++)
      if (A[i][k])
        for (long long j = 0; j < B[0].size(); j++)
          add_self(Res[i][j], mul(A[i][k], B[k][j]));
  return Res;
}
vector<vector<long long> > Power(const vector<vector<long long> >& A,
                                 long long k) {
  if (!k) return Identity(A.size());
  if (k & 1) return Muliply(A, Power(A, k - 1));
  return Power(Muliply(A, A), k >> 1);
}
long long a[N];
int main() {
  Fact[0] = 1;
  for (long long i = 1; i < N; i++) Fact[i] = mul(i, Fact[i - 1]);
  long long n, k;
  scanf("%I64d%I64d", &n, &k);
  for (long long i = 0; i < n; i++) scanf("%I64d", a + i);
  long long c0 = 0, c1 = 0, ok0 = 0;
  for (long long i = 0; i < n; i++) a[i] ? c1++ : c0++;
  for (long long i = 0; i < c0; i++)
    if (!a[i]) ok0++;
  vector<vector<long long> > Init = Zero(1, n + 1);
  vector<vector<long long> > Trans = Zero(n + 1, n + 1);
  Init[0][ok0] = 1;
  for (long long i = 0; i < n + 1; i++) {
    long long L0 = i, R0 = c0 - i;
    long long L1 = c0 - i, R1 = c1 - c0 + i;
    if (L0 < 0 || R0 < 0 || L1 < 0 || R1 < 0) continue;
    add_self(Trans[i][i], C(c0, 2));
    add_self(Trans[i][i], C(c1, 2));
    add_self(Trans[i][i], mul(L0, R0));
    add_self(Trans[i][i], mul(L1, R1));
    if (i + 1 < n + 1) add_self(Trans[i][i + 1], mul(L1, R0));
    if (i - 1 >= 0) add_self(Trans[i][i - 1], mul(L0, R1));
  }
  vector<vector<long long> > Staff = Muliply(Init, Power(Trans, k));
  long long P = Staff[0][c0];
  long long Q = fp(C(n, 2), k);
  long long G = GCD(P, Q);
  P /= G, Q /= G;
  long long Ans = inv(P, Q);
  cout << Ans;
}
