#include <bits/stdc++.h>
using namespace std;
const int N = 110;
const int mo = 1e9 + 7;
int n, k, a[N], num[3], nn, f = 0;
long long ans, now[N][N], dp[N][N], aa[N];
long long po(long long a, long long b) {
  if (b == 0) return 1;
  if (b == 1) return a;
  long long c = po(a, b / 2);
  if (b & 1)
    return c * c % mo * a % mo;
  else
    return c * c % mo;
}
long long tmp[N][N];
void multi(long long a[][N], long long b[][N], int n) {
  memset(tmp, 0, sizeof tmp);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      for (int k = 0; k < n; k++)
        tmp[i][j] = (tmp[i][j] + a[i][k] * b[k][j] % mo) % mo;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) a[i][j] = tmp[i][j];
}
long long res[N][N];
void Pow(long long a[][N], long long n) {
  memset(res, 0, sizeof res);
  for (int i = 0; i < num[0] + 1; i++) res[i][i] = 1;
  while (n) {
    if (n & 1) multi(res, a, num[0] + 1);
    multi(a, a, num[0] + 1);
    n >>= 1;
  }
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), num[a[i]]++;
  if (num[0] < num[1]) {
    for (int i = 1; i <= num[0]; i++)
      if (!a[i]) nn++;
  } else {
    swap(num[0], num[1]);
    for (int i = n; i >= n - num[0] + 1; i--)
      if (a[i]) nn++;
  }
  for (int j = 0; j <= num[0]; j++) {
    now[j][j] += j * (num[0] - j);
    now[j][j] += (num[0] - j) * (num[1] - num[0] + j);
    now[j][j] += num[0] * (num[0] - 1) / 2ll;
    now[j][j] += num[1] * (num[1] - 1) / 2ll;
    if (j + 1 <= num[0]) now[j][j + 1] = (j + 1) * (num[1] - (num[0] - j - 1));
    if (j) now[j][j - 1] = (num[0] - j + 1) * (num[0] - j + 1);
  }
  Pow(now, k);
  for (int i = 0; i <= num[0]; i++) ans = (ans + res[i][nn]) % mo;
  printf("%lld\n", res[num[0]][nn] * po(ans, mo - 2) % mo);
  return 0;
}
