#include <bits/stdc++.h>
const long long md = 1e9 + 7;
const int Inf = 1e9;
const long long Inf64 = 1e18;
const long long MaxN = 200001;
const long long MaxM = 1000001;
const long double eps = 1e-15;
const long long dx[4] = {0, 1, 0, -1};
const long long dy[4] = {1, 0, -1, 0};
using namespace std;
long long gcd(long long a, long long b) {
  while (a) {
    b %= a;
    swap(a, b);
  }
  return b;
}
long long gcdex(long long a, long long b, long long& x, long long& y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  } else {
    long long x1, y1;
    long long d = gcdex(b % a, a, x1, y1);
    x = y1 - (b / a) * x1;
    y = x1;
    return d;
  }
}
struct Mat {
  long long a[105][105];
  long long N;
  Mat() { memset(a, 0, sizeof(a)); }
  Mat(long long n) {
    N = n;
    memset(a, 0, sizeof(a));
  }
  Mat operator*(Mat b) {
    Mat c = Mat(N);
    for (int i = 0; i <= N; i++) {
      for (int j = 0; j <= N; j++) {
        for (int k = 0; k <= N; k++) {
          c.a[i][j] = (c.a[i][j] + a[i][k] * b.a[k][j]) % md;
        }
      }
    }
    return c;
  }
};
Mat e_pow(Mat a, long long s) {
  Mat c(a.N);
  for (int i = 0; i <= a.N; i++) {
    c.a[i][i] = 1;
  }
  while (s) {
    if (s & 1) c = c * a;
    a = a * a;
    s >>= 1;
  }
  return c;
}
long long e_pow(long long a, long long s) {
  long long c = 1;
  while (s) {
    if (s & 1) c = (c * a) % md;
    a = (a * a) % md;
    s >>= 1;
  }
  return c;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long N, K;
  cin >> N >> K;
  vector<long long> A(N);
  long long ed = 0;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    ed += A[i];
  }
  long long no = N - ed;
  Mat Mt(N);
  long long cnt = 0;
  for (int i = 0; i < no; i++) {
    cnt += A[i];
  }
  for (int i = 0; i <= N; i++) {
    Mt.a[i][i] = no * (no - 1) / 2 + ed * (ed - 1) / 2;
    if (no > i) Mt.a[i][i] += (no - i) * i;
    if (ed > i) Mt.a[i][i] += (ed - i) * i;
    if (i < N) {
      if (ed > i && no > i) Mt.a[i][i + 1] = (ed - i) * (no - i);
    }
    if (i > 0) {
      Mt.a[i][i - 1] = i * i;
    }
  }
  Mt = e_pow(Mt, K);
  cerr << e_pow(e_pow(N * (N - 1) / 2, K), md - 2);
  long long Ans = Mt.a[cnt][0] * e_pow(e_pow(N * (N - 1) / 2, K), md - 2) % md;
  cout << Ans;
  cerr << '\n'
       << "Time execute: " << clock() / (double)CLOCKS_PER_SEC << " sec"
       << '\n';
  return 0;
}
