#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int N = 110;
long long kOper, n, cnt;
long long c[N];
struct Matrix {
  long long x[N][N];
  Matrix() {
    for (int i = 0; i <= N - 1; ++i)
      for (int j = 0; j <= N - 1; ++j) x[i][j] = 0;
  }
  void show() {
    for (int i = 0; i <= cnt; ++i) {
      for (int j = 0; j <= cnt; ++j) cout << x[i][j] << ' ';
      cout << '\n';
    }
  }
} a, b;
long long px(long long a, long long q) {
  if (q == 0) return 1;
  long long tmp = px(a, q / 2);
  tmp = (tmp * tmp) % MOD;
  if (q & 1) tmp = (tmp * a) % MOD;
  return tmp;
}
Matrix mul(Matrix &a, Matrix &b) {
  Matrix c;
  for (int i = 0; i <= cnt; ++i)
    for (int j = 0; j <= cnt; ++j)
      for (int k = 0; k <= cnt; ++k)
        c.x[i][j] = (c.x[i][j] + a.x[i][k] * b.x[k][j]) % MOD;
  return c;
}
Matrix px(Matrix a, long long q) {
  if (q == 1) return a;
  Matrix tmp = px(a, q / 2);
  tmp = mul(tmp, tmp);
  if (q & 1) tmp = mul(tmp, a);
  return tmp;
}
long long sum(long long n) { return n * (n - 1) / 2 % MOD; }
void read() {
  cin >> n >> kOper;
  for (int i = 1; i <= n; ++i) {
    cin >> c[i];
    cnt += (!c[i]);
  }
  int cur = 0;
  for (int i = 1; i <= cnt; ++i) cur += (!c[i]);
  a.x[0][cur] = 1;
  for (int j = 0; j <= cnt; ++j) {
    b.x[j][j] = (sum(cnt) + sum(n - cnt) + j * (cnt - j) +
                 (cnt - j) * (n - 2 * cnt + j)) %
                MOD;
    if (j > 0) b.x[j - 1][j] = (cnt - j + 1) * (cnt - j + 1) % MOD;
    b.x[j + 1][j] = (j + 1) * (n - 2 * cnt + j + 1) % MOD;
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  read();
  b = px(b, kOper);
  a = mul(a, b);
  long long sum = 0;
  for (int i = 0; i <= cnt; ++i) sum = (sum + a.x[0][i]) % MOD;
  cout << a.x[0][cnt] * px(sum, MOD - 2) % MOD << '\n';
}
