#include <bits/stdc++.h>
using namespace std;
const int MAXN = 105;
const int MOD = 1e9 + 7;
struct Mat {
  long long a[MAXN][MAXN];
  int n;
  Mat(int n) : n(n) { memset(a, 0, sizeof(a)); }
};
Mat operator*(Mat a, Mat b) {
  Mat c(a.n);
  for (int i = 0; i <= a.n; i++) {
    for (int j = 0; j <= a.n; j++) {
      for (int k = 0; k <= a.n; k++) {
        c.a[i][j] += a.a[i][k] * b.a[k][j] % MOD;
        c.a[i][j] %= MOD;
      }
    }
  }
  return c;
}
Mat exp_mod(Mat a, long long b) {
  Mat ret(a.n);
  for (int i = 0; i <= a.n; i++) {
    ret.a[i][i] = 1;
  }
  while (b) {
    if (b & 1) ret = ret * a;
    a = a * a;
    b >>= 1;
  }
  return ret;
}
long long exp_mod(long long a, long long b) {
  long long ret = 1;
  while (b) {
    if (b & 1) ret = ret * a % MOD;
    a = a * a % MOD;
    b >>= 1;
  }
  return ret;
}
int a[MAXN];
int c0, c1, cnt;
int main(void) {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    if (a[i])
      c1++;
    else
      c0++;
  }
  cnt = c1;
  for (int i = n - c1 + 1; i <= n; i++) {
    if (a[i]) cnt--;
  }
  Mat A(n);
  for (int i = 0; i <= n; i++) {
    A.a[i][i] = c0 * (c0 - 1) / 2 + c1 * (c1 - 1) / 2;
    if (c0 > i) A.a[i][i] += (c0 - i) * i;
    if (c1 > i) A.a[i][i] += (c1 - i) * i;
    if (i < n) {
      if (c1 > i && c0 > i) A.a[i][i + 1] = (c1 - i) * (c0 - i);
    }
    if (i > 0) {
      A.a[i][i - 1] = i * i;
    }
  }
  A = exp_mod(A, k);
  long long ans =
      A.a[cnt][0] * exp_mod(exp_mod(n * (n - 1) / 2, k), MOD - 2) % MOD;
  printf("%lld\n", ans);
}
