#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long inf = 0x3f3f3f3f3f3f3f3f;
const long long mod = 1e9 + 7;
const int N = 110;
struct Mat {
  int a[N][N];
  int r, c;
  Mat(int _r, int _c) { r = _r, c = _c, memset(a, 0, sizeof(a)); }
};
Mat operator*(Mat X, Mat Y) {
  Mat Z(X.r, Y.c);
  for (int i = 0; i < X.r; ++i) {
    for (int j = 0; j < Y.c; ++j) {
      for (int k = 0; k < X.c; ++k) {
        Z.a[i][j] = (Z.a[i][j] + 1ll * X.a[i][k] * Y.a[k][j] % mod) % mod;
      }
    }
  }
  return Z;
}
Mat pow(Mat a, long long n) {
  Mat res(a.r, a.c);
  for (int i = 0; i < a.r; i++) res.a[i][i] = 1;
  while (n) {
    if (n & 1) res = res * a;
    ;
    a = a * a;
    n >>= 1;
  }
  return res;
}
long long Pow(long long a, long long b) {
  long long res = 1ll;
  while (b) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return res;
}
int n, k;
int a[N], c, x;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    c += (a[i] == 0);
  }
  for (int i = 1; i <= c; i++) x += (a[i] == 0);
  Mat dp(c + 1, 1);
  Mat A(c + 1, c + 1);
  dp.a[x][0] = 1;
  for (int i = 0; i <= c; i++) {
    if (i > 0) A.a[i][i - 1] = (c - i + 1) * (c - i + 1);
    if (i < c) A.a[i][i + 1] = (i + 1) * (n - 2 * c + i + 1);
    A.a[i][i] = c * (c - 1) / 2 + (n - c) * (n - c - 1) / 2 + i * (c - i) +
                (c - i) * (n - 2 * c + i);
  }
  A = pow(A, k);
  dp = A * dp;
  long long tmp = 0ll;
  for (int i = 0; i <= c; i++) tmp = (tmp + dp.a[i][0]) % mod;
  printf("%lld\n", dp.a[c][0] * Pow(tmp, mod - 2) % mod);
  return 0;
}
