#include <bits/stdc++.h>
#pragma GCC optimize("-Ofast")
using namespace std;
void err(istream_iterator<string> it) { cerr << endl; }
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << "\t";
  err(++it, args...);
}
template <typename T1, typename T2>
ostream& operator<<(ostream& c, pair<T1, T2>& v) {
  c << "(" << v.first << "," << v.second << ")";
  return c;
}
template <template <class...> class TT, class... T>
ostream& operator<<(ostream& out, TT<T...>& c) {
  out << "{ ";
  for (auto& x : c) out << x << " ";
  out << "}";
  return out;
}
const int LIM = 1e5 + 5, MOD = 1e9 + 7;
const long double EPS = 1e-9;
const long long MAX_N = 105;
struct Matrix {
  long long mat[MAX_N][MAX_N];
};
Matrix matMul(Matrix a, Matrix b) {
  Matrix ans;
  int i, j, k;
  for (i = 0; i < MAX_N; i++)
    for (j = 0; j < MAX_N; j++)
      for (ans.mat[i][j] = k = 0; k < MAX_N; k++) {
        ans.mat[i][j] += (a.mat[i][k] * b.mat[k][j]) % MOD;
        ans.mat[i][j] %= MOD;
      }
  return ans;
}
Matrix matPow(Matrix base, long long p) {
  p %= MOD;
  Matrix ans;
  long long i, j;
  for (i = 0; i < MAX_N; i++)
    for (j = 0; j < MAX_N; j++) ans.mat[i][j] = (i == j);
  while (p) {
    if (p & 1) ans = matMul(ans, base);
    base = matMul(base, base);
    p >>= 1;
  }
  return ans;
}
int fpow(int a, int p) {
  if (p == 0) return 1;
  long long z = fpow(a, p / 2);
  z = (z * z) % MOD;
  if (p % 2) z = (z * a) % MOD;
  return z;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  vector<int> v;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    v.push_back(x);
  }
  reverse(v.begin(), v.end());
  long long tot = 0;
  for (int i = 0; i < n; ++i) {
    if (v[i]) tot++;
  }
  long long cnt = 0;
  for (int i = 0; i < tot; ++i) {
    if (v[i]) cnt++;
  }
  Matrix m;
  for (int i = 0; i < tot + 1; ++i) {
    for (int j = 0; j < tot + 1; ++j) {
      if (i + n - tot < tot) {
        m.mat[i][j] = 0;
        continue;
      }
      if (abs(i - j) > 1)
        m.mat[i][j] = 0;
      else if (i == j) {
        m.mat[i][j] = tot * (tot - 1) / 2 + (n - tot) * (n - tot - 1) / 2 +
                      i * (tot - i) + (tot - i) * (n - 2 * tot + i);
      } else if (i - j == 1) {
        m.mat[i][j] = (i) * (n - 2 * tot + i);
      } else if (j - i == 1) {
        m.mat[i][j] = (tot - i) * (tot - i);
      }
      m.mat[i][j] %= MOD;
    }
  }
  Matrix ans = matPow(m, k);
  long long a1 = 0, a2 = 0;
  a1 = ans.mat[cnt][tot];
  for (int i = 0; i < tot + 1; ++i) {
    a2 += ans.mat[cnt][i];
    a2 %= MOD;
  }
  long long ansf = 0;
  ansf = a1;
  ansf *= fpow(a2, MOD - 2);
  cout << (ansf) % MOD << '\n';
  return 0;
}
