#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
ll modpow(ll x, ll p, ll mod) {
  ll res = 1LL;
  for (; p; p >>= 1, (x *= x) %= mod)
    if (p & 1) (res *= x) %= mod;
  return res;
}
template <ll mod>
struct Mint {
  ll x;
  Mint(ll x = 0) : x((x %= mod) < 0 ? x + mod : x) {}
  Mint& operator+=(const Mint& rhs) {
    if ((x += rhs.x) >= mod) x -= mod;
    return *this;
  }
  Mint& operator-=(const Mint& rhs) { return *this += mod - rhs.x; }
  Mint& operator*=(const Mint& rhs) {
    (x *= rhs.x) %= mod;
    return *this;
  }
  Mint& operator/=(const Mint& rhs) {
    return *this *= modpow(rhs.x, mod - 2, mod);
  }
  Mint power(ll p) const { return Mint(modpow(x, p, mod)); }
  bool operator==(const Mint& rhs) const { return x == rhs.x; }
  bool operator<(const Mint& rhs) const { return x < rhs.x; }
  friend Mint operator+(const Mint& lhs, const Mint& rhs) {
    return Mint(lhs) += rhs;
  }
  friend Mint operator-(const Mint& lhs, const Mint& rhs) {
    return Mint(lhs) -= rhs;
  }
  friend Mint operator*(const Mint& lhs, const Mint& rhs) {
    return Mint(lhs) *= rhs;
  }
  friend Mint operator/(const Mint& lhs, const Mint& rhs) {
    return Mint(lhs) /= rhs;
  }
  friend ostream& operator<<(ostream& out, const Mint& a) { return out << a.x; }
  friend istream& operator>>(istream& in, Mint& a) {
    ll x;
    in >> x;
    a = Mint(x);
    return in;
  }
};
template <typename T>
T templatepow(T x, ll p) {
  assert(p >= 0);
  T res(1);
  while (p > 0) {
    if (p & 1) res = res * x;
    x = x * x, p >>= 1;
  }
  return res;
}
template <typename T, int N, int M>
struct Matrix {
  T A[N][M];
  int row[N];
  Matrix() {
    fill(&A[0][0], &A[0][0] + N * M, T(0));
    iota(begin(row), end(row), 0);
  }
  Matrix(T value) : Matrix() {
    for (int i = 0; i < min(N, M); ++i) A[i][i] = value;
  }
  Matrix(initializer_list<initializer_list<T>> lst) : Matrix() {
    int i = 0, j = 0;
    for (const auto& v : lst) {
      for (const auto& x : v) A[i][j++] = x;
      i++, j = 0;
    }
  }
  T* operator[](int i) { return A[row[i]]; }
  const T* operator[](int i) const { return A[row[i]]; }
  void swap_rows(int i, int j) { swap(row[i], row[j]); }
  template <typename Op>
  Matrix& compose(const Matrix& rhs, Op&& op) {
    auto& lhs = *this;
    for (int i = 0; i < N; ++i)
      for (int j = 0; j < M; ++j) lhs[i][j] = op(lhs[i][j], rhs[i][j]);
    return *this;
  }
  Matrix& operator+=(const Matrix& rhs) { return compose(rhs, std::plus<T>()); }
  Matrix& operator-=(const Matrix& rhs) {
    return compose(rhs, std::minus<T>());
  }
  Matrix operator+(const Matrix& rhs) const { return Matrix(*this) += rhs; }
  Matrix operator-(const Matrix& rhs) const { return Matrix(*this) -= rhs; }
  template <int K>
  Matrix<T, N, K> operator*(const Matrix<T, M, K>& rhs) const {
    const auto& lhs = *this;
    Matrix<T, N, K> res;
    for (int i = 0; i < N; ++i)
      for (int j = 0; j < K; ++j)
        for (int k = 0; k < M; ++k) res[i][j] += lhs[i][k] * rhs[k][j];
    return res;
  }
  friend Matrix operator*(const T& alpha, Matrix A) {
    for (int i = 0; i < N; ++i)
      for (int j = 0; j < M; ++j) A[i][j] *= alpha;
    return A;
  }
};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  constexpr ll mod = 1e9 + 7;
  using mint = Mint<mod>;
  int n;
  ll k;
  cin >> n >> k;
  vector<int> a(n);
  for (auto& x : a) cin >> x;
  constexpr int nmax = 100;
  Matrix<mint, nmax, nmax> A;
  mint p = 1 / mint(1LL * n * (n - 1) / 2);
  int ones = accumulate(begin(a), end(a), 0), zeros = n - ones,
      N = min(ones, zeros);
  for (int x = 0; x <= N; ++x) {
    A[x][x] = 1 - (1LL * x * x + 1LL * (ones - x) * (zeros - x)) * p;
    if (x + 1 <= N) A[x][x + 1] = (1LL * (ones - x) * (zeros - x)) * p;
    if (x > 0) A[x][x - 1] = (1LL * x * x) * p;
  }
  A = templatepow(A, k);
  int x = 0;
  for (int i = 0; i < zeros; ++i) x += a[i] == 1;
  cerr << "x"
       << " == " << (x) << '\n';
  ;
  mint ans = A[x][0];
  cout << ans << '\n';
  exit(0);
}
