#include <bits/stdc++.h>
using namespace std;
const int N = 102;
long long int mod = 1e9 + 7, b[N];
struct matrix {
  long long int n, m;
  long long int a[N][N];
  matrix(int nn, int mm) {
    n = nn;
    m = mm;
  }
  void ide() {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        a[i][j] = (i == j);
      }
    }
  }
  void emp() {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        a[i][j] = 0;
      }
    }
  }
};
void out(matrix o) {
  cout << o.n << ' ' << o.m << '\n';
  for (int i = 0; i < o.n; i++) {
    for (int j = 0; j < o.m; j++) {
      cout << o.a[i][j] << ' ';
    }
    cout << '\n';
  }
  cout << '\n';
}
long long int wop(long long int x, long long int y) {
  long long int ret = 1;
  for (; y >= 1; y /= 2) {
    if (y & 1) ret *= x;
    x *= x;
    ret %= mod;
    x %= mod;
  }
  return ret;
}
matrix operator*(matrix A, matrix B) {
  matrix ret(A.n, B.m);
  ret.emp();
  for (int i = 0; i < A.n; i++) {
    for (int j = 0; j < B.m; j++) {
      for (int k = 0; k < A.m; k++) {
        ret.a[i][j] += (A.a[i][k] * B.a[k][j]) % mod;
        ret.a[i][j] %= mod;
      }
    }
  }
  return ret;
}
matrix mult(matrix x, long long int k) {
  matrix ret(x.n, x.m);
  ret.ide();
  for (; k >= 1; k /= 2) {
    if (k & 1) ret = ret * x;
    x = x * x;
  }
  return ret;
}
long long int kasr(long long int sor, long long int mag) {
  return (sor * wop(mag, mod - 2)) % mod;
}
int ze = 0, on, fr;
bool not_valid(int x) { return ze - x <= on; }
long long int chos(long long int x) { return (x * (x - 1)) / 2; }
int main() {
  int t, k;
  cin >> t >> k;
  for (int i = 0; i < t; i++) {
    cin >> b[i];
    ze += (b[i] == 0);
  }
  on = t - ze;
  fr = 0;
  for (int i = 0; i < ze; i++) {
    fr += b[i] == 0;
  }
  matrix mat(ze + 1, ze + 1);
  mat.emp();
  for (int i = 0; i <= ze; i++) {
    if (!not_valid(i)) continue;
    mat.a[i][i] += kasr((i * (ze - i)) + ((ze - i) * (on - (ze - i))), chos(t));
    mat.a[i][i] %= mod;
    mat.a[i][i] += kasr(chos(on), chos(t));
    mat.a[i][i] %= mod;
    mat.a[i][i] += kasr(chos(ze), chos(t));
    mat.a[i][i] %= mod;
    if (i != ze) {
      mat.a[i][i + 1] += kasr((ze - i) * (ze - i), chos(t));
      mat.a[i][i + 1] %= mod;
    }
    if (i - 1 >= 0) {
      mat.a[i][i - 1] += kasr((on - (ze - i)) * i, chos(t));
      mat.a[i][i - 1] %= mod;
    }
  }
  matrix ans = mult(mat, k);
  cout << (ans.a[fr][ze]);
}
