#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &item) {
  out << '(' << item.first << ", " << item.second << ')';
  return out;
}
template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  for (const auto &item : v) out << item << ' ';
  return out;
}
const int NMAX = 110;
const int MOD = 1000000007;
struct matrix {
  int n;
  int v[NMAX][NMAX];
  matrix() { memset(v, 0, sizeof v); }
  friend matrix operator*(const matrix &a, const matrix &b) {
    matrix c;
    c.n = a.n;
    for (int i = 0; i < a.n; ++i)
      for (int j = 0; j < a.n; ++j) {
        c.v[i][j] = 0;
        for (int k = 0; k < a.n; ++k) {
          c.v[i][j] = (c.v[i][j] + 1LL * a.v[i][k] * b.v[k][j]) % MOD;
        }
      }
    return c;
  }
  friend ostream &operator<<(ostream &out, const matrix &m) {
    for (int i = 0; i < m.n; ++i) {
      for (int j = 0; j < m.n; ++j) out << m.v[i][j] << ' ';
      if (i + 1 < m.n) out << '\n';
    }
    return out;
  }
};
matrix pw(matrix base, int exp) {
  matrix res;
  res.n = base.n;
  for (int i = 0; i < res.n; ++i) res.v[i][i] = 1;
  for (; exp; exp >>= 1) {
    if (exp & 1) res = res * base;
    base = base * base;
  }
  return res;
}
int pw(int base, int exp) {
  int res;
  for (res = 1; exp; exp >>= 1) {
    if (exp & 1) res = 1LL * res * base % MOD;
    base = 1LL * base * base % MOD;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  int i, n, k, n0, n1, x;
  string s;
  cin >> n >> k;
  for (n0 = n1 = 0, i = 0; i < n; ++i) {
    cin >> x;
    if (x)
      ++n1;
    else
      ++n0;
    s += '0' + x;
  }
  int low = max(n0 - n1, 0);
  int down = pw((1LL * n * (n - 1) / 2) % MOD, MOD - 2);
  matrix m;
  m.n = n0 + 1;
  for (x = low; x <= n0; ++x) {
    int p1 = (1LL * (n0 - x + 1) * (n0 - x + 1)) % MOD;
    p1 = (1LL * p1 * down) % MOD;
    if (x - 1 < low) p1 = 0;
    int p2 = (1LL * (x + 1) * (n1 - n0 + x + 1)) % MOD;
    p2 = (1LL * p2 * down) % MOD;
    if (x + 1 > n0) p2 = 0;
    int p3 = (1LL * n0 * (n0 - 1) / 2 + 1LL * n1 * (n1 - 1) / 2 +
              1LL * x * (n0 - x) + 1LL * (n0 - x) * (n1 - n0 + x)) %
             MOD;
    p3 = (1LL * p3 * down) % MOD;
    if (x - 1 >= low) m.v[x - 1][x] = p1;
    m.v[x][x] = p3;
    if (x + 1 <= n0) m.v[x + 1][x] = p2;
  }
  m = pw(m, k);
  for (x = 0, i = 0; i < n0; ++i) x += (s[i] == '0');
  cout << m.v[x][n0] << '\n';
  return 0;
}
