#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f, M = 1e9 + 7;
const long long LINF = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1), EPS = 1e-9;
const int N = 101;
long long b[N];
long long o;
int n, k;
template <class T>
T fm(T a, T b) {
  return (-b < a and a < b) ? a : a % b;
}
template <int m = M>
struct modArit {
  modArit(int v = 0) : v(fm(v, m)) {}
  modArit(long long v) : v(fm(v, (long long)m)) {}
  int v;
  modArit<m> operator+(modArit<m> r) const { return modArit<m>(v + r.v); }
  modArit<m> operator-(modArit<m> r) const { return modArit<m>(v - r.v); }
  modArit<m> operator*(modArit<m> r) const {
    return modArit<m>((long long)v * r.v);
  }
  modArit<m> operator/(modArit<m> r) const { return *this * inv(r); }
  modArit<m> operator/(int r) const { return modArit<m>(v / r); }
};
template <class T = modArit<>>
struct Matrix {
  T a[N][N] = {};
  Matrix(int d = 0) {
    for (int i = 0; i < n; i++) a[i][i] = d;
  }
  Matrix<T> operator*(const Matrix<T> r) {
    Matrix<T> ans;
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++)
        for (int k = 0; k < n; k++)
          ans.a[i][j] = ans.a[i][j] + a[i][k] * r.a[k][j];
    return ans;
  }
};
template <class T>
T fexp(T b, long long e) {
  T r = 1;
  while (e) {
    if (e & 1) r = r * b;
    b = b * b, e /= 2;
  }
  return r;
}
template <int m>
modArit<m> inv(modArit<m> x) {
  return fexp(x, m - 2);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> k;
  auto f = inv<M>((n * (n - 1) / 2));
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    if (b[i]) o++;
  }
  Matrix<> m;
  auto t = min(n - o, o);
  modArit<> nn = n, oo = o;
  for (int i = 0; i <= t; i++) {
    modArit<> ii = i;
    m.a[i][i] = (nn * (nn - 1) / 2 - ii * ii - (oo - ii) * (nn - oo - ii)) * f;
    if (i > 0) m.a[i][i - 1] = ii * ii * f;
    m.a[i][i + 1] = (oo - ii) * (nn - oo - ii) * f;
  }
  Matrix<> a = fexp(m, k);
  int id = 0;
  for (int i = 0; i < n - o; i++)
    if (b[i]) id++;
  cout << fexp(m, k).a[id][0].v << endl;
  return 0;
}
