#include <bits/stdc++.h>
using namespace std;
const int p = 1000000007;
struct matrix {
  int a[105][105];
} b;
int tot, st, a[105], ans[105];
int read() {
  char c = getchar();
  int x = 0, f = 1;
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * f;
}
int pow_mod(int x, int k) {
  int ans = 1;
  while (k) {
    if (k & 1) ans = 1LL * ans * x % p;
    x = 1LL * x * x % p;
    k >>= 1;
  }
  return ans;
}
matrix times(matrix x, matrix y) {
  matrix ans;
  memset(ans.a, 0, sizeof(ans.a));
  for (int i = 0; i <= tot; i++) {
    for (int j = 0; j <= tot; j++) {
      for (int k = 0; k <= tot; k++) {
        ans.a[i][k] = (ans.a[i][k] + 1LL * x.a[i][j] * y.a[j][k]) % p;
      }
    }
  }
  return ans;
}
matrix fpow(matrix x, int k) {
  --k;
  matrix ans = x;
  while (k) {
    if (k & 1) ans = times(ans, x);
    x = times(x, x);
    k >>= 1;
  }
  return ans;
}
int main() {
  int n = read(), k = read();
  tot = 0, st = 0;
  for (int i = 1; i <= n; i++) {
    a[i] = read();
    if (a[i] == 0) ++tot;
  }
  for (int i = 1; i <= tot; i++)
    if (a[i] == 0) ++st;
  int t = 1LL * n * (n - 1) / 2 % p;
  t = pow_mod(t, p - 2);
  for (int i = 0; i <= tot; i++) {
    int a0 = i, a1 = tot - i, b0 = tot - i, b1 = n - a0 - a1 - b0;
    if (i < tot) b.a[i][i + 1] = 1LL * a1 * b0 % p * t % p;
    if (i > 0) b.a[i][i - 1] = 1LL * a0 * b1 % p * t % p;
    b.a[i][i] =
        (1 + p - 1LL * a1 * b0 % p * t % p + p - 1LL * a0 * b1 % p * t % p) % p;
  }
  b = fpow(b, k);
  int sum = 0;
  for (int i = 0; i <= tot; i++) {
    sum += b.a[st][i];
    if (sum >= p) sum -= p;
  }
  printf("%d\n", 1LL * b.a[st][tot] * pow_mod(sum, p - 2) % p);
  return 0;
}
