#include <bits/stdc++.h>
using namespace std;
long long n, k;
int arr[100];
long long len = 0;
long long us(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) {
      ans *= a;
      ans %= 1000000007;
    }
    b >>= 1;
    a *= a;
    a %= 1000000007;
  }
  return ans;
}
long long md(long long a) {
  return ((a % 1000000007) + 1000000007) % 1000000007;
}
long long fa[101], fb[101], fc[101];
long long solarr[103];
typedef struct mtr {
  long long mat[103][103];
} mtr;
mtr *nmat;
long long f(int num0, int remk) {
  if (remk == 0) return num0 == len;
  long long ans = 0;
  ans += (fa[num0] * f(num0, remk - 1)) % 1000000007;
  ans %= 1000000007;
  ans += (fb[num0] * f(num0 - 1, remk - 1)) % 1000000007;
  ans %= 1000000007;
  ans += (fc[num0] * f(num0 + 1, remk - 1)) % 1000000007;
  ans %= 1000000007;
  return ans;
}
void carp(mtr *mat1, mtr *mat2) {
  mtr *tmp = (mtr *)malloc(sizeof(mtr));
  for (int i = 0; i < n + 3; i++) {
    for (int j = 0; j < n + 3; j++) {
      long long top = 0;
      for (int k = 0; k < n + 3; k++) {
        top += (mat1->mat[i][k] * mat2->mat[k][j]) % 1000000007;
        top %= 1000000007;
      }
      tmp->mat[i][j] = top;
    }
  }
  for (int i = 0; i < n + 3; i++) {
    for (int j = 0; j < n + 3; j++) {
      mat1->mat[i][j] = tmp->mat[i][j];
    }
  }
  free(tmp);
}
void matexp(mtr *mat, long long us) {
  mtr *tmp = (mtr *)malloc(sizeof(mtr));
  for (int i = 0; i < n + 3; i++) {
    for (int j = 0; j < n + 3; j++) {
      tmp->mat[i][j] = i == j;
    }
  }
  while (us) {
    if (us & 1) {
      carp(tmp, mat);
    }
    us >>= 1;
    carp(mat, mat);
  }
  for (int i = 0; i < n + 3; i++) {
    for (int j = 0; j < n + 3; j++) {
      mat->mat[i][j] = tmp->mat[i][j];
    }
  }
  free(tmp);
}
void printmat(mtr *mat) {
  for (int i = 0; i < n + 3; i++) {
    for (int j = 0; j < n + 3; j++) {
      cout << nmat->mat[i][j] << " ";
    }
    cout << endl;
  }
  cout << endl;
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    if (arr[i] == 0) len++;
  }
  for (int i = 0; i <= n; i++) {
    long long l0 = i;
    long long r0 = len - i;
    long long l1 = len - i;
    long long r1 = n - len - len + i;
    if (l0 < 0 || r0 < 0 || l1 < 0 || r1 < 0) {
      fa[i] = 0;
      fb[i] = 0;
      fc[i] = 0;
      continue;
    }
    long long a = ((md(md(len * (len - 1)) * 500000004) +
                    md(md((n - len) * (n - len - 1)) * 500000004)) %
                       1000000007 +
                   md(r0 * l0) + md(r1 * l1)) %
                  1000000007;
    long long b = ((i) * (n - len - len + i)) % 1000000007;
    long long c = ((len - i) * (len - i)) % 1000000007;
    fa[i] = a;
    fb[i] = b;
    fc[i] = c;
  }
  nmat = (mtr *)malloc(sizeof(mtr));
  for (int i = 0; i < n + 3; i++) {
    for (int j = 0; j < n + 3; j++) {
      if (i == 0)
        nmat->mat[i][j] = 0;
      else if (i == n + 2)
        nmat->mat[i][j] = 0;
      else {
        long long num = n + 1 - i;
        if (num + j == n)
          nmat->mat[i][j] = fc[num];
        else if (num + j == n + 1)
          nmat->mat[i][j] = fa[num];
        else if (num + j == n + 2)
          nmat->mat[i][j] = fb[num];
        else
          nmat->mat[i][j] = 0;
      }
    }
  }
  matexp(nmat, k % 1000000007);
  solarr[0] = 0;
  solarr[n + 2] = 0;
  for (int i = 1; i < n + 2; i++) {
    long long num = n + 1 - i;
    solarr[i] = (num == len);
  }
  long long cur0 = 0;
  for (int i = 0; i < len; i++)
    if (arr[i] == 0) cur0++;
  long long ind = n + 1 - cur0;
  long long pay = 0;
  for (int j = 0; j < n + 3; j++) {
    pay += (nmat->mat[ind][j] * solarr[j]) % 1000000007;
    pay %= 1000000007;
  }
  long long payda = us((n * (n - 1)) / 2, k % 1000000007);
  pay *= us(payda, 1000000007 - 2);
  pay %= 1000000007;
  cout << pay << endl;
}
