#include <bits/stdc++.h>
using namespace std;
const int M = 105;
const int mod = 1000000007;
struct Matrix {
  long long int val[M][M];
} I;
Matrix mul(Matrix A, Matrix B) {
  Matrix C;
  for (int i = 0; i < M; i++)
    for (int j = 0; j < M; j++) {
      C.val[i][j] = 0;
      for (int k = 0; k < M; k++) {
        C.val[i][j] += A.val[i][k] * B.val[k][j] % mod;
      }
      C.val[i][j] %= mod;
    }
  return C;
}
Matrix poww(Matrix A, int b) {
  Matrix tmp = I;
  while (b) {
    if (b & 1) {
      tmp = mul(tmp, A);
    }
    b >>= 1;
    A = mul(A, A);
  }
  return tmp;
}
long long int poww(long long int a, long long int b) {
  if (!a) return 0;
  long long int tmp = 1;
  while (b) {
    if (b & 1) {
      tmp = tmp * a % mod;
    }
    b >>= 1;
    a = a * a % mod;
  }
  return tmp;
}
int main() {
  for (int i = 0; i < M; i++) {
    I.val[i][i] = 1;
  }
  long long int n, k;
  scanf("%lld%lld", &n, &k);
  int zero = 0;
  int one = 0;
  int start;
  vector<int> arr;
  for (int i = 0; i < n; i++) {
    int first;
    scanf("%d", &first);
    arr.push_back(first);
    if (first == 0) {
      zero++;
    } else {
      one++;
    }
  }
  for (int i = 0; i < zero; i++) {
    if (arr[i] == 0) {
      start++;
    }
  }
  Matrix mat;
  memset(mat.val, 0, sizeof(mat.val));
  for (int i = 0; i <= zero; i++) {
    long long int inc = (zero - i) * (zero - i);
    long long int dec = i * (one - zero + i);
    long long int same = n * (n - 1) / 2 - inc - dec;
    mat.val[i][i] = same % mod * poww(n * (n - 1) / 2, mod - 2) % mod;
    if (i < zero)
      mat.val[i + 1][i] = inc % mod * poww(n * (n - 1) / 2, mod - 2) % mod;
    if (i > 0)
      mat.val[i - 1][i] = dec % mod * poww(n * (n - 1) / 2, mod - 2) % mod;
    ;
  }
  mat = poww(mat, k);
  cout << mat.val[zero][start] << endl;
}
