A girl named Sonya is studying in the scientific lyceum of the Kingdom of Kremland. The teacher of computer science (Sonya's favorite subject!) invented a task for her.Given an array $$$a$$$ of length $$$n$$$, consisting only of the numbers $$$0$$$ and $$$1$$$, and the number $$$k$$$. Exactly $$$k$$$ times the following happens:   Two numbers $$$i$$$ and $$$j$$$ are chosen equiprobable such that ($$$1 \leq i < j \leq n$$$).  The numbers in the $$$i$$$ and $$$j$$$ positions are swapped. Sonya's task is to find the probability that after all the operations are completed, the $$$a$$$ array will be sorted in non-decreasing order. She turned to you for help. Help Sonya solve this problem.It can be shown that the desired probability is either $$$0$$$ or it can be represented as $$$\dfrac{P}{Q}$$$, where $$$P$$$ and $$$Q$$$ are coprime integers and $$$Q \not\equiv 0~\pmod {10^9+7}$$$.

The first line contains two integers $$$n$$$ and $$$k$$$ ($$$2 \leq n \leq 100, 1 \leq k \leq 10^9$$$) — the length of the array $$$a$$$ and the number of operations. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \le a_i \le 1$$$) — the description of the array $$$a$$$.

If the desired probability is $$$0$$$, print $$$0$$$, otherwise print the value $$$P \cdot Q^{-1}$$$ $$$\pmod {10^9+7}$$$, where $$$P$$$ and $$$Q$$$ are defined above.

NoteIn the first example, all possible variants of the final array $$$a$$$, after applying exactly two operations: $$$(0, 1, 0)$$$, $$$(0, 0, 1)$$$, $$$(1, 0, 0)$$$, $$$(1, 0, 0)$$$, $$$(0, 1, 0)$$$, $$$(0, 0, 1)$$$, $$$(0, 0, 1)$$$, $$$(1, 0, 0)$$$, $$$(0, 1, 0)$$$. Therefore, the answer is $$$\dfrac{3}{9}=\dfrac{1}{3}$$$.In the second example, the array will not be sorted in non-decreasing order after one operation, therefore the answer is $$$0$$$.

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        F solver = new F();
        solver.solve(1, in, out);
        out.close();
    }

    static class F {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int n = in.ni(), k = in.ni();
            int[] p = in.na(n);
            long mod = (int) 1e9 + 7;

            long cnt0 = 0, cnt1 = 0;
            for (int i = 0; i < n; i++) {
                if (p[i] == 1)
                    cnt1++;
                else
                    cnt0++;
            }

            if (cnt0 == 0 || cnt1 == 0) {
                out.println(1);
                return;
            }
            long N = (cnt0 + cnt1) * (cnt0 + cnt1 - 1) / 2 % mod;

            long[][] matrix = new long[(int) cnt0 + 1][(int) cnt0 + 1]; // m[i][j] - moving from state j to state i
            long pSame = (cnt0 * (cnt0 - 1) / 2 + cnt1 * (cnt1 - 1) / 2) % mod; // exchange withing groups
            int from = Math.max(0, (int) (cnt0 - cnt1));
            for (int i = from; i <= cnt0; i++) { // i - amount of 0 in first group
                matrix[i][i] = ((cnt0 - i) * (cnt1 - cnt0 + 2 * i) % mod + pSame) % mod;//between groups but same numbers
                if (i < cnt0) {
                    matrix[i + 1][i] = (cnt0 - i) * (cnt0 - i) % mod; // increasing amount of 0s, cnt0-i number of 0s in second group and 1s in first
                }
                if (i > from) {
                    matrix[i - 1][i] = i * (cnt1 - cnt0 + i) % mod; // decreasing amount of 0s
                }
            }
//        for (int i = 0; i <= cnt0; i++) {
//            System.out.println(Arrays.toString(matrix[i]));
//        }
            int a0 = 0;
            for (int i = 0; i < cnt0; i++) {
                if (p[i] == 0)
                    a0++;
            }
            long[] start = new long[(int) cnt0 + 1];
            start[a0] = 1; // initial state

            long[][] mPow = MatrixUtils.binPow(matrix, k, mod);
            long[] res = new long[(int) cnt0 + 1];
            MatrixUtils.multiply(mPow, start, res, mod);

            long invNK = IntegerUtils.pow(N, mod - 1 - k, mod);
            out.println(res[(int) cnt0] * invNK % mod);

        }

    }

    static class MatrixUtils {
        public static long[][] binPow(long[][] a, long k, long mod) {
            int n = a.length;
            long[][] res = new long[n][n];
            long[][] aa = new long[n][n];
            for (int i = 0; i < n; i++) {
                res[i][i] = 1;
                for (int j = 0; j < n; j++) {
                    aa[i][j] = a[i][j];
                }
            }
            long[][] nxt = new long[n][n];
            long[][] tmp;
            while (k > 0) {
                if (k % 2 == 0) {
                    multiply(aa, aa, nxt, mod);
                    tmp = aa;
                    aa = nxt;
                    nxt = tmp;
                    k /= 2;
                } else {
                    multiply(aa, res, nxt, mod);
                    tmp = nxt;
                    nxt = res;
                    res = tmp;
                    k--;
                }
            }
            return res;
        }

        public static void multiply(long[][] a, long[][] b, long[][] res, long mod) {
            for (int i = 0; i < res.length; i++) {
                for (int j = 0; j < res[i].length; j++) {
                    res[i][j] = 0;
                    for (int k = 0; k < b.length; k++) {
                        res[i][j] = (res[i][j] + a[i][k] * b[k][j]) % mod;
                    }
                }
            }
        }

        public static void multiply(long[][] a, long[] b, long[] res, long mod) {
            for (int i = 0; i < res.length; i++) {
                res[i] = 0;
                for (int k = 0; k < b.length; k++) {
                    res[i] = (res[i] + a[i][k] * b[k]) % mod;
                }
            }
        }

    }

    static class IntegerUtils {
        public static long pow(long a, long p, long mod) {
            if (p == 0) {
                return 1;
            }
            long t = pow(a, p / 2, mod);

            if (p % 2 != 0) {
                return (((t * t) % mod) * a) % mod;
            } else {
                return (t * t) % mod;
            }
        }

    }

    static class FastScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public FastScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String ns() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public int ni() {
            return Integer.parseInt(ns());
        }

        public int[] na(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = ni();
            return a;
        }

    }
}

import java.io.*;
import java.util.*;

public class Codeforces1151F {

	public static void main(String[] args) throws IOException {
		int P = 1000000007;

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int n = Integer.parseInt(st.nextToken());
		int k = Integer.parseInt(st.nextToken());
		st = new StringTokenizer(br.readLine());
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(st.nextToken());
		}

		//count number of zeroes in array
		int r = 0;
		for (int i = 0; i < n; i++) {
			r += (1-a[i]);
		}
		//count number of ones in first r things
		int s = 0;
		for (int i = 0; i < r; i++) {
			s += a[i];
		}

		if (r > (n/2)) {
			r = n-r;
		}

		int nC2Inv = (n*(n-1))/2;
		nC2Inv = inverse(nC2Inv, P);

		//create matrix
		int[][] matrix = new int[r+1][r+1];
		for (int i = 0; i <= r; i++) {
			matrix[i][i] = 1;
			if (i > 0) {
				matrix[i][i-1] = multiply(i*i, nC2Inv, P);
				matrix[i][i] = (matrix[i][i] + P - matrix[i][i-1])%P;
			}
			if (i < r) {
				matrix[i][i+1] = multiply(((r-i)*(n-r-i)), nC2Inv, P);
				matrix[i][i] = (matrix[i][i] + P - matrix[i][i+1])%P;
			}
		}

		//matrix power k
		int[][] ans = power(matrix, k, P);
		System.out.println(ans[s][0]);
	}

	public static int[][] power(int[][] a, int k, int N) {
		if (k == 1) {
			return a;
		}
		else {
			int[][] prod = multiply(a, a, N);
			int[][] ans = power(prod, k/2, N);
			if (k%2 == 1) {
				ans = multiply(ans, a, N);
			}
			return ans;
		}

	}

	public static int[][] multiply (int[][] a, int[][] b, int N) {
		int n = a.length;
		int m = a[0].length;
		int p = b[0].length;

		int[][] ans = new int[n][p];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < p; j++) {
				for (int k = 0; k < m; k++) {
					ans[i][j] = (ans[i][j] + multiply(a[i][k], b[k][j], N))%N;
				}
			}
		}

		return ans;
	}

	public static int multiply (int a, int b, int n) {
		long ab = (long) a * (long) b;
		return ((int) (ab%n));
	}

	public static int inverse (int a, int n) {
		int m = n;
		int r1 = 1;
		int r2 = 0;
		int r3 = 0;
		int r4 = 1;
		while ((a > 0) && (n > 0)) {
			if (n >= a) {
				r3 -= r1*(n/a);
				r4 -= r2*(n/a);
				n = n%a;
			}
			else {
				int tmp = a;
				a = n;
				n = tmp;
				tmp = r1;
				r1 = r3;
				r3 = tmp;
				tmp = r2;
				r2 = r4;
				r4 = tmp;
			}
		}
		if (a == 0) {
			if (r3 >= 0)
				return (r3%m);
			else
				return (m+(r3%m));
		}
		else {
			if (r1 >= 0)
				return (r1%m);
			else
				return (m+(r1%m));
		}

	}

}

import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class Main {
    static final long MOD = 1_000_000_007 , INF = 1_000_000_000_000_000L;
    static final int INf = 1_000_000_000;
    static FastReader reader;
    static PrintWriter writer;
    public static void main(String[] args) {
        Thread t = new Thread(null, new O(), "Integer.MAX_VALUE", 100000000);
        t.start();
    }
    static class O implements Runnable {
        public void run() {
            try {
                magic();
            }
            catch (Exception e) {
                e.printStackTrace();
                System.exit(1);
            }
        }
    }
    static class FastReader {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public FastReader() {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public FastReader(String file_name) throws IOException {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[1000000];
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n') break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg) return -ret;
            return ret;
        }

        public long nextLong() throws IOException {
            long ret = 0;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg) return -ret;
            return ret;
        }

        public double nextDouble() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (c == '.') while ((c = read()) >= '0' && c <= '9') ret += (c - '0') / (div *= 10);
            if (neg) return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1) buffer[0] = -1;
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead) fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException {
            if (din == null) return;
            din.close();
        }
    }

    static void magic() throws IOException {
        reader = new FastReader();
        writer = new PrintWriter(System.out, true);
        int n = reader.nextInt(), k = reader.nextInt();
        int arr[] = new int[n], curr = 0, x = 0;
        for(int i=0;i<n;++i) {
            arr[i] = reader.nextInt();
            if(arr[i]==0) {
                ++curr;
            }
        }
        for(int i=0;i<curr;++i) {
            if(arr[i]==0) {
                ++x;
            }
        }
        //writer.println("curr: "+curr+" x: "+x);
        long a[] = new long[curr+1];
        a[x] = 1;
        long M[][] = new long[curr+1][curr+1];
        for(int i=0;i<=curr;++i) {
            M[i][i] = C2(curr) + C2(n-curr) + i*(curr-i) + (curr-i) * (n-curr-(curr-i));
            if(i>0) {
                M[i-1][i] = (curr-i+1)*(curr-i+1);
            }
            if(i+1<=curr) {
                M[i+1][i] = (i+1) * (n-curr-(curr-(i+1)));
            }
        }
        M = exponentiateMatrix(M,  curr+1,k);
        long ans[] = new long[curr+1];
        for(int i=0;i<=curr;++i) {
            for(int j=0;j<=curr;++j) {
                ans[i] += a[j]*M[j][i];
                ans[i] %= MOD;
            }
        }
        long nr = ans[curr];
        long dr = 0;
        for(int i=0;i<=curr;++i) {
            dr+=ans[i];
            dr%=MOD;
        }
        writer.println((nr*modpow(dr, MOD-2))%MOD);
    }
    /**
     *
     * @param a
     * @param b
     * @param k
     * @return the product of the two (k*k) matrices a and b
     */
    static long[][] multiply(long a[][], long b[][], int k) {
        long c[][] = new long[k][k];
        for(int i=0;i<k;++i) {
            for(int j=0;j<k;++j) {
                for(int K=0;K<k;++K) {
                    c[i][j] = (c[i][j] + a[i][K]*b[K][j])%MOD;
                }
            }
        }
        return c;
    }

    /**
     *
     * @param mat
     * @param k
     * @param n
     * @return Finds the matrix: mat^n, here mat is a (k*k) matrix
     */
    static long[][] exponentiateMatrix(long mat[][], int k, long n) {
        if(n==1) {
            return mat;
        }
        if(n%2==0) {
            long half[][] = exponentiateMatrix(mat, k, n/2);
            return multiply(half, half, k);
        }
        return multiply(mat, exponentiateMatrix(mat,k, n-1), k);
    }
    static long C2(long n) {
        if(n<2) {
            return 0;
        }
        return (n*(n-1))/2;
    }
    static long modpow(long x, long y) {
        if(y==0) {
            return 1;
        }
        if((y&1)==0) {
            return modpow((x*x)%MOD, y>>1);
        }
        return (x*modpow(x, y-1))%MOD;
    }
}

import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.math.BigInteger;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.PriorityQueue;
import java.util.Random;
import java.util.TreeSet;

public final class CF_553_D2_F
{

	static boolean verb=true;
	static void log(Object X){if (verb) System.err.println(X);}
	static void log(Object[] X){if (verb) {for (Object U:X) System.err.print(U+" ");System.err.println("");}}
	static void log(int[] X){if (verb) {for (int U:X) System.err.print(U+" ");System.err.println("");}}
	static void log(int[] X,int L){if (verb) {for (int i=0;i<L;i++) System.err.print(X[i]+" ");System.err.println("");}}
	static void log(long[] X){if (verb) {for (long U:X) System.err.print(U+" ");System.err.println("");}}

	static void logWln(Object X){if (verb) System.err.print(X);}
	static void info(Object o){	System.out.println(o);}
	static void output(Object o){outputWln(""+o+"\n");	}
	static void outputWln(Object o){try {out.write(""+ o);} catch (Exception e) {}}

	static long powerMod(long b,long e,long m){
		long x=1;
		while (e>0) {
			if (e%2==1)
				x=(b*x)%m;
			b=(b*b)%m;
			e=e/2;
		}
		return x;
	}

	static long inv(long x,long mod){
		return powerMod(x,mod-2,mod);
	}

	static long[][] mult(long[][] A,long[][] B,long mod){
		int M=A.length;
		long[][] res=new long[M][M];
		for (int i=0;i<M;i++)
			for (int j=0;j<M;j++) {
				res[i][j]=0;
				for (int k=0;k<M;k++) {
					res[i][j]+=A[i][k]*B[k][j];
					if (res[i][j]>=mod)
						res[i][j]%=mod;
				}

			}
		return res;
	}

	static long[][] powerMat(long[][] A,long e,long mod){
		long[][] X=null;
		long[][] B=A;
		while (e>0) {
			if (e%2==1) {
				if (X==null)
					X=B;
				else
					X=mult(B,X,mod);
			}
			B=mult(B,B,mod);
			e=e/2;
		}
		return X;
	}

	static long mult(long a,long b,long mod){
		long c=a*b;
		if (c>=mod)
			c%=mod;
		return c;
	}

	static long mod=1000000007;

	// Global vars
	static BufferedWriter out;
	static InputReader reader;
	static int[] anc,rank,max,list;

	static void process() throws Exception {

		out = new BufferedWriter(new OutputStreamWriter(System.out));
		reader = new InputReader(System.in);

		int n=reader.readInt();
		int[] a=new int[n];
		long k=reader.readInt();

		log(inv(2,mod));
		int zer=0;
		int one=0;
		for (int i=0;i<n;i++){
			a[i]=reader.readInt();
			if (a[i]==0)
				zer++;
			else
				one++;
		}

		int MX=zer+1;
		long[][] mat=new long[MX][MX];
		// lets prob[x] = probability that we got x "zeroes" in the first zer position
		// how to move from prob[x] to prob[y]
		// too interesting case: a zero below zer pos is changed with a one beyond
		// or same with one and zero

		long nn=(n*(n-1))/2;
		long invnn=inv(nn,mod);

		for (int x=0;x<MX;x++){
			long A=0;
			long B=0;
			if (x>0){
				// take a zero below zer

				long prob1=x;
				//log("prob1:"+prob1);
				// take a one beyond zer

				// how many ones beyond zer
				long prob2=one-(zer-x);
				if (prob2>=0){
				//log("prob2:"+prob2);
				A=mult(prob1,prob2,mod);
				A=mult(A,invnn,mod);
				mat[x][x-1]=A;
				}
			}
			if (x<zer){
				// take a one below zer

				long prob1=zer-x;
				// take a zero beyond zer

				long prob2=zer-x;
				if (prob2>=0){
				B=mult(prob1,prob2,mod);
				B=mult(B,invnn,mod);
				mat[x][x+1]=B;
				}
			}
			long C=(mod-A);
			if (C>=mod)
				C-=mod;
			C+=(mod-B);
			if (C>=mod)
				C-=mod;
			C++;
			if (C>=mod)
				C-=mod;
			mat[x][x]=C;
		}
		/*
		log("----------");
		for (int i=0;i<MX;i++){
			log(mat[i]);
		}
		*/
		long[][] matk=powerMat(mat,k,mod);
		int bob=0;
		for (int i=0;i<zer;i++){
			if (a[i]==0)
				bob++;
		}
		//log("bob:"+bob);
		output(matk[bob][zer]);

		/*
		for (int i=0;i<MX;i++){
			log(matk[i]);
		}
		*/

		try {
			out.close();
		} catch (Exception e) {
		}

	}

	public static void main(String[] args) throws Exception {
		process();

	}

	static final class InputReader {
		private final InputStream stream;
		private final byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		private int read() throws IOException {
			if (curChar >= numChars) {
				curChar = 0;
				numChars = stream.read(buf);
				if (numChars <= 0) {
					return -1;
				}
			}
			return buf[curChar++];
		}

		public final String readString() throws IOException {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			StringBuilder res = new StringBuilder();
			do {
				res.append((char) c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public final int readInt() throws IOException {
			int c = read();
			boolean neg = false;
			while (isSpaceChar(c)) {
				c = read();
			}
			char d = (char) c;
			// log("d:"+d);
			if (d == '-') {
				neg = true;
				c = read();
			}
			int res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			// log("res:"+res);
			if (neg)
				return -res;
			return res;

		}

		public final long readLong() throws IOException {
			int c = read();
			boolean neg = false;
			while (isSpaceChar(c)) {
				c = read();
			}
			char d = (char) c;
			// log("d:"+d);
			if (d == '-') {
				neg = true;
				c = read();
			}
			long res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			// log("res:"+res);
			if (neg)
				return -res;
			return res;

		}

		private boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
	}

}

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.charset.Charset;
import java.util.Arrays;
import java.util.Random;

public class CFContest {
    public static void main(String[] args) throws Exception {
        boolean local = System.getProperty("ONLINE_JUDGE") == null;
        boolean async = false;

        Charset charset = Charset.forName("ascii");

        FastIO io = local ? new FastIO(new FileInputStream("D:\\DATABASE\\TESTCASE\\Code.in"), System.out, charset) : new FastIO(System.in, System.out, charset);
        Task task = new Task(io, new Debug(local));

        if (async) {
            Thread t = new Thread(null, task, "dalt", 1 << 27);
            t.setPriority(Thread.MAX_PRIORITY);
            t.start();
            t.join();
        } else {
            task.run();
        }

        if (local) {
            io.cache.append("\n\n--memory -- \n" + ((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) >> 20) + "M");
        }

        io.flush();
    }

    public static class Task implements Runnable {
        final FastIO io;
        final Debug debug;
        int inf = (int) 1e8;
        int mod = (int) 1e9 + 7;

        public int mod(int val) {
            val %= mod;
            if (val < 0) {
                val += mod;
            }
            return val;
        }

        public int mod(long val) {
            val %= mod;
            if (val < 0) {
                val += mod;
            }
            return (int) val;
        }

        int bitAt(int x, int i) {
            return (x >> i) & 1;
        }

        int bitAt(long x, int i) {
            return (int) ((x >> i) & 1);
        }

        public Task(FastIO io, Debug debug) {
            this.io = io;
            this.debug = debug;
        }

        @Override
        public void run() {
            solve();
        }

        public void solve() {
            int n = io.readInt();
            int k = io.readInt();
            int[] a = new int[n];
            int[] numCounts = new int[2];
            for (int i = 0; i < n; i++) {
                a[i] = io.readInt();
                numCounts[a[i]]++;
            }

            Matrix t = new Matrix(numCounts[0] + 1, numCounts[0] + 1);
            for (int j = 0; j <= numCounts[0]; j++) {
                t.mat[j][j] += numCounts[0] * (numCounts[0] - 1) / 2;
                t.mat[j][j] += numCounts[1] * (numCounts[1] - 1) / 2;
                t.mat[j][j] += (numCounts[0] - j) * (numCounts[1] - numCounts[0] + j);
                t.mat[j][j] += j * (numCounts[0] - j);
                if (j + 1 <= numCounts[0]) {
                    t.mat[j][j + 1] = (j + 1) * (numCounts[1] - (numCounts[0] - j - 1));
                }
                if (j - 1 >= 0) {
                    t.mat[j][j - 1] = (numCounts[0] - j + 1) * (numCounts[0] - j + 1);
                }
            }
            Matrix state = new Matrix(numCounts[0] + 1, 1);
            int prev = 0;
            for (int i = 0; i < numCounts[0]; i++) {
                if (a[i] == 0) {
                    prev++;
                }
            }
            state.mat[prev][0] = 1;

            Matrix finalState = Matrix.mul(Matrix.pow(t, k), state);
            int validCount = finalState.mat[numCounts[0]][0];
            int total = Mathematics.pow(n * (n - 1) / 2, k, mod);
            int possibilities = mod((long)validCount * Mathematics.inverse(total, mod));

            io.cache.append(possibilities);
        }

    }

    public static class Matrix {
        int[][] mat;
        int n;
        int m;
        static int mod = (int) 1e9 + 7;

        public Matrix(int n, int m) {
            this.n = n;
            this.m = m;
            mat = new int[n][m];
        }

        public void fill(int v) {
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    mat[i][j] = v;
                }
            }
        }

        public void asStandard() {
            fill(0);
            for (int i = 0; i < n && i < m; i++) {
                mat[i][i] = 1;
            }
        }

        public static Matrix mul(Matrix a, Matrix b) {
            Matrix c = new Matrix(a.n, b.m);
            for (int i = 0; i < c.n; i++) {
                for (int j = 0; j < c.m; j++) {
                    for (int k = 0; k < a.m; k++) {
                        c.mat[i][j] = (int) ((c.mat[i][j] + (long) a.mat[i][k] * b.mat[k][j]) % mod);
                    }
                }
            }
            return c;
        }

        public static Matrix pow(Matrix x, int n) {
            if (n == 0) {
                Matrix r = new Matrix(x.n, x.m);
                r.asStandard();
                return r;
            }
            Matrix r = pow(x, n >> 1);
            r = Matrix.mul(r, r);
            if (n % 2 == 1) {
                r = Matrix.mul(r, x);
            }
            return r;
        }

    }

    public static class Segment implements Cloneable {
        Segment left;
        Segment right;
        int cnt;

        public static Segment build(int l, int r) {
            Segment segment = new Segment();
            segment.left = segment.right = segment;
            return segment;
        }

        public static boolean checkOutOfRange(int ll, int rr, int l, int r) {
            return ll > r || rr < l;
        }

        public static boolean checkCoverage(int ll, int rr, int l, int r) {
            return ll <= l && rr >= r;
        }

        public static void update(int ll, int rr, int l, int r, Segment segment) {
            if (checkOutOfRange(ll, rr, l, r)) {
                return;
            }
            if (checkCoverage(ll, rr, l, r)) {
                return;
            }
            int m = (l + r) >> 1;

            segment.pushDown();
            update(ll, rr, l, m, segment.left);
            update(ll, rr, m + 1, r, segment.right);
            segment.pushUp();
        }

        public static Segment updatePersistently(int ll, int rr, int l, int r, Segment segment) {
            if (checkOutOfRange(ll, rr, l, r)) {
                return segment;
            }
            segment = segment.clone();
            if (checkCoverage(ll, rr, l, r)) {
                segment.cnt++;
                return segment;
            }

            int m = (l + r) >> 1;

            segment.pushDown();
            segment.left = updatePersistently(ll, rr, l, m, segment.left);
            segment.right = updatePersistently(ll, rr, m + 1, r, segment.right);
            segment.pushUp();
            return segment;
        }

        public static void query(int ll, int rr, int l, int r, Segment segment) {
            if (checkOutOfRange(ll, rr, l, r)) {
                return;
            }
            if (checkCoverage(ll, rr, l, r)) {
                return;
            }
            int m = (l + r) >> 1;

            segment.pushDown();
            query(ll, rr, l, m, segment.left);
            query(ll, rr, m + 1, r, segment.right);
        }

        public static int floor(int l, int r, Segment old, Segment now, int v) {
            if (l > v || now.cnt <= old.cnt) {
                return -1;
            }
            if (l == r) {
                return l;
            }
            int m = (l + r) >> 1;
            int res = -1;
            if (now.right.cnt > old.right.cnt) {
                res = floor(m + 1, r, old.right, now.right, v);
            }

            if (res == -1) {
                res = floor(l, m, old.left, now.left, v);
            }
            return res;
        }

        public static int ceil(int l, int r, Segment old, Segment now, int v) {
            if (r < v || now.cnt <= old.cnt) {
                return -1;
            }
            if (l == r) {
                return l;
            }
            int m = (l + r) >> 1;
            int res = -1;
            if (now.left.cnt > old.left.cnt) {
                res = ceil(l, m, old.left, now.left, v);
            }
            if (res == -1) {
                res = ceil(m + 1, r, old.right, now.right, v);
            }
            return res;
        }

        public void pushDown() {
        }

        public void pushUp() {
            cnt = left.cnt + right.cnt;
        }

        @Override
        public Segment clone() {
            try {
                return (Segment) super.clone();
            } catch (CloneNotSupportedException e) {
                throw new RuntimeException(e);
            }
        }
    }

    public static class FastIO {
        public final StringBuilder cache = new StringBuilder();
        private final InputStream is;
        private final OutputStream os;
        private final Charset charset;
        private StringBuilder defaultStringBuf = new StringBuilder(1 << 8);
        private byte[] buf = new byte[1 << 13];
        private int bufLen;
        private int bufOffset;
        private int next;

        public FastIO(InputStream is, OutputStream os, Charset charset) {
            this.is = is;
            this.os = os;
            this.charset = charset;
        }

        public FastIO(InputStream is, OutputStream os) {
            this(is, os, Charset.forName("ascii"));
        }

        private int read() {
            while (bufLen == bufOffset) {
                bufOffset = 0;
                try {
                    bufLen = is.read(buf);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
                if (bufLen == -1) {
                    return -1;
                }
            }
            return buf[bufOffset++];
        }

        public void skipBlank() {
            while (next >= 0 && next <= 32) {
                next = read();
            }
        }

        public int readInt() {
            int sign = 1;

            skipBlank();
            if (next == '+' || next == '-') {
                sign = next == '+' ? 1 : -1;
                next = read();
            }

            int val = 0;
            if (sign == 1) {
                while (next >= '0' && next <= '9') {
                    val = val * 10 + next - '0';
                    next = read();
                }
            } else {
                while (next >= '0' && next <= '9') {
                    val = val * 10 - next + '0';
                    next = read();
                }
            }

            return val;
        }

        public long readLong() {
            int sign = 1;

            skipBlank();
            if (next == '+' || next == '-') {
                sign = next == '+' ? 1 : -1;
                next = read();
            }

            long val = 0;
            if (sign == 1) {
                while (next >= '0' && next <= '9') {
                    val = val * 10 + next - '0';
                    next = read();
                }
            } else {
                while (next >= '0' && next <= '9') {
                    val = val * 10 - next + '0';
                    next = read();
                }
            }

            return val;
        }

        public double readDouble() {
            boolean sign = true;
            skipBlank();
            if (next == '+' || next == '-') {
                sign = next == '+';
                next = read();
            }

            long val = 0;
            while (next >= '0' && next <= '9') {
                val = val * 10 + next - '0';
                next = read();
            }
            if (next != '.') {
                return sign ? val : -val;
            }
            next = read();
            long radix = 1;
            long point = 0;
            while (next >= '0' && next <= '9') {
                point = point * 10 + next - '0';
                radix = radix * 10;
                next = read();
            }
            double result = val + (double) point / radix;
            return sign ? result : -result;
        }

        public String readString(StringBuilder builder) {
            skipBlank();

            while (next > 32) {
                builder.append((char) next);
                next = read();
            }

            return builder.toString();
        }

        public String readString() {
            defaultStringBuf.setLength(0);
            return readString(defaultStringBuf);
        }

        public int readLine(char[] data, int offset) {
            int originalOffset = offset;
            while (next != -1 && next != '\n') {
                data[offset++] = (char) next;
                next = read();
            }
            return offset - originalOffset;
        }

        public int readString(char[] data, int offset) {
            skipBlank();

            int originalOffset = offset;
            while (next > 32) {
                data[offset++] = (char) next;
                next = read();
            }

            return offset - originalOffset;
        }

        public int readString(byte[] data, int offset) {
            skipBlank();

            int originalOffset = offset;
            while (next > 32) {
                data[offset++] = (byte) next;
                next = read();
            }

            return offset - originalOffset;
        }

        public char readChar() {
            skipBlank();
            char c = (char) next;
            next = read();
            return c;
        }

        public void flush() {
            try {
                os.write(cache.toString().getBytes(charset));
                os.flush();
                cache.setLength(0);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        public boolean hasMore() {
            skipBlank();
            return next != -1;
        }
    }

    public static class Debug {
        private boolean allowDebug;

        public Debug(boolean allowDebug) {
            this.allowDebug = allowDebug;
        }

        public void assertTrue(boolean flag) {
            if (!allowDebug) {
                return;
            }
            if (!flag) {
                fail();
            }
        }

        public void fail() {
            throw new RuntimeException();
        }

        public void assertFalse(boolean flag) {
            if (!allowDebug) {
                return;
            }
            if (flag) {
                fail();
            }
        }

        private void outputName(String name) {
            System.out.print(name + " = ");
        }

        public void debug(String name, int x) {
            if (!allowDebug) {
                return;
            }

            outputName(name);
            System.out.println("" + x);
        }

        public void debug(String name, long x) {
            if (!allowDebug) {
                return;
            }
            outputName(name);
            System.out.println("" + x);
        }

        public void debug(String name, double x) {
            if (!allowDebug) {
                return;
            }
            outputName(name);
            System.out.println("" + x);
        }

        public void debug(String name, int[] x) {
            if (!allowDebug) {
                return;
            }
            outputName(name);
            System.out.println(Arrays.toString(x));
        }

        public void debug(String name, long[] x) {
            if (!allowDebug) {
                return;
            }
            outputName(name);
            System.out.println(Arrays.toString(x));
        }

        public void debug(String name, double[] x) {
            if (!allowDebug) {
                return;
            }
            outputName(name);
            System.out.println(Arrays.toString(x));
        }

        public void debug(String name, Object x) {
            if (!allowDebug) {
                return;
            }
            outputName(name);
            System.out.println("" + x);
        }

        public void debug(String name, Object... x) {
            if (!allowDebug) {
                return;
            }
            outputName(name);
            System.out.println(Arrays.deepToString(x));
        }
    }

    public static class Randomized {
        static Random random = new Random(12345678);

        public static double nextDouble(double min, double max) {
            return random.nextDouble() * (max - min) + min;
        }

        public static void randomizedArray(int[] data, int from, int to) {
            to--;
            for (int i = from; i <= to; i++) {
                int s = nextInt(i, to);
                int tmp = data[i];
                data[i] = data[s];
                data[s] = tmp;
            }
        }

        public static void randomizedArray(long[] data, int from, int to) {
            to--;
            for (int i = from; i <= to; i++) {
                int s = nextInt(i, to);
                long tmp = data[i];
                data[i] = data[s];
                data[s] = tmp;
            }
        }

        public static void randomizedArray(double[] data, int from, int to) {
            to--;
            for (int i = from; i <= to; i++) {
                int s = nextInt(i, to);
                double tmp = data[i];
                data[i] = data[s];
                data[s] = tmp;
            }
        }

        public static void randomizedArray(float[] data, int from, int to) {
            to--;
            for (int i = from; i <= to; i++) {
                int s = nextInt(i, to);
                float tmp = data[i];
                data[i] = data[s];
                data[s] = tmp;
            }
        }

        public static <T> void randomizedArray(T[] data, int from, int to) {
            to--;
            for (int i = from; i <= to; i++) {
                int s = nextInt(i, to);
                T tmp = data[i];
                data[i] = data[s];
                data[s] = tmp;
            }
        }

        public static int nextInt(int l, int r) {
            return random.nextInt(r - l + 1) + l;
        }
    }

    public static class Mathematics {

        public static int ceilPowerOf2(int x) {
            return 32 - Integer.numberOfLeadingZeros(x - 1);
        }

        public static int floorPowerOf2(int x) {
            return 31 - Integer.numberOfLeadingZeros(x);
        }

        public static long modmul(long a, long b, long mod) {
            return b == 0 ? 0 : ((modmul(a, b >> 1, mod) << 1) % mod + a * (b & 1)) % mod;
        }

        /**
         * Get the greatest common divisor of a and b
         */
        public static int gcd(int a, int b) {
            return a >= b ? gcd0(a, b) : gcd0(b, a);
        }

        private static int gcd0(int a, int b) {
            return b == 0 ? a : gcd0(b, a % b);
        }

        public static int extgcd(int a, int b, int[] coe) {
            if (a >= b) {
                return extgcd0(a, b, coe);
            } else {
                int g = extgcd0(b, a, coe);
                int tmp = coe[0];
                coe[0] = coe[1];
                coe[1] = tmp;
                return g;
            }
        }

        private static int extgcd0(int a, int b, int[] coe) {
            if (b == 0) {
                coe[0] = 1;
                coe[1] = 0;
                return a;
            }
            int g = extgcd0(b, a % b, coe);
            int n = coe[0];
            int m = coe[1];
            coe[0] = m;
            coe[1] = n - m * (a / b);
            return g;
        }

        /**
         * Get the greatest common divisor of a and b
         */
        public static long gcd(long a, long b) {
            return a >= b ? gcd0(a, b) : gcd0(b, a);
        }

        private static long gcd0(long a, long b) {
            return b == 0 ? a : gcd0(b, a % b);
        }

        public static long extgcd(long a, long b, long[] coe) {
            if (a >= b) {
                return extgcd0(a, b, coe);
            } else {
                long g = extgcd0(b, a, coe);
                long tmp = coe[0];
                coe[0] = coe[1];
                coe[1] = tmp;
                return g;
            }
        }

        private static long extgcd0(long a, long b, long[] coe) {
            if (b == 0) {
                coe[0] = 1;
                coe[1] = 0;
                return a;
            }
            long g = extgcd0(b, a % b, coe);
            long n = coe[0];
            long m = coe[1];
            coe[0] = m;
            coe[1] = n - m * (a / b);
            return g;
        }

        /**
         * Get y where x * y = 1 (% mod)
         */
        public static int inverse(int x, int mod) {
            return pow(x, mod - 2, mod);
        }

        /**
         * Get x^n(% mod)
         */
        public static int pow(int x, int n, int mod) {
            int bit = 31 - Integer.numberOfLeadingZeros(n);
            long product = 1;
            for (; bit >= 0; bit--) {
                product = product * product % mod;
                if (((1 << bit) & n) != 0) {
                    product = product * x % mod;
                }
            }
            return (int) product;
        }

        public static long longpow(long x, long n, long mod) {
            if (n == 0) {
                return 1;
            }
            long prod = longpow(x, n >> 1, mod);
            prod = modmul(prod, prod, mod);
            if ((n & 1) == 1) {
                prod = modmul(prod, x, mod);
            }
            return prod;
        }

        /**
         * Get x % mod
         */
        public static int mod(int x, int mod) {
            x %= mod;
            if (x < 0) {
                x += mod;
            }
            return x;
        }

        public static int mod(long x, int mod) {
            x %= mod;
            if (x < 0) {
                x += mod;
            }
            return (int) x;
        }

        /**
         * Get n!/(n-m)!
         */
        public static long permute(int n, int m) {
            return m == 0 ? 1 : n * permute(n - 1, m - 1);
        }

        /**
         * Put all primes less or equal to limit into primes after offset
         */
        public static int eulerSieve(int limit, int[] primes, int offset) {
            boolean[] isComp = new boolean[limit + 1];
            int wpos = offset;
            for (int i = 2; i <= limit; i++) {
                if (!isComp[i]) {
                    primes[wpos++] = i;
                }
                for (int j = offset, until = limit / i; j < wpos && primes[j] <= until; j++) {
                    int pi = primes[j] * i;
                    isComp[pi] = true;
                    if (i % primes[j] == 0) {
                        break;
                    }
                }
            }
            return wpos - offset;
        }

        /**
         * Round x into integer
         */
        public static int intRound(double x) {
            if (x < 0) {
                return -(int) (-x + 0.5);
            }
            return (int) (x + 0.5);
        }

        /**
         * Round x into long
         */
        public static long longRound(double x) {
            if (x < 0) {
                return -(long) (-x + 0.5);
            }
            return (long) (x + 0.5);
        }
    }
}

import java.util.*;
import java.io.*;
public class EdC {
	static long[] mods = {1000000007, 998244353, 1000000009};
	static long mod = mods[0];
	public static MyScanner sc;
    public static PrintWriter out;
    static int y;
	public static void main(String[] omkar) throws Exception{
		// TODO Auto-generated method stub
 		sc = new MyScanner();
 		out = new PrintWriter(System.out);
 		int n = sc.nextInt();
 		long k = sc.nextLong();
 		int[] array = readArrayInt(n);
 		y = 0;
 		int initial = 0;
 		for(int j =0;j<n;j++)
 			if (array[j] == 1)
 				y++;
 		for(int j =n-y;j<n;j++)
 			if (array[j] == 1)
 				initial++;
 		long[][] matrix = new long[y+1][y+1];
 		for(int j = 0;j<=y;j++){
 			long s = n;
 			s*=(long)(n-1);
 			s/=2;
 			if (j-1 >=0){
 				matrix[j-1][j]=j;
 				matrix[j-1][j]%=mod;
 				matrix[j-1][j]*=(long)(n-2*y+j);
 				matrix[j-1][j]%=mod;
 				s-=matrix[j-1][j];
 				s%=mod;
 				s+=mod;
 				s%=mod;
 			}
 			if (j+1 <= y){
 				matrix[j+1][j]=(y-j);
 				matrix[j+1][j]%=mod;
 				matrix[j+1][j]*=(long)(y-j);
 				matrix[j+1][j]%=mod;
 				s-=matrix[j+1][j];
 				s%=mod;
 				s+=mod;
 				s%=mod;
 			}
 			matrix[j][j] = s;

 		}
 		long[][] product = power(matrix, k);
 		long ans = product[y][initial];
 		ans%=mod;
 		long nC2 = n;
 		nC2*=(long)(n-1);
 		nC2/=2L;
 		long div = power(nC2, mod-2);
 		ans*=power(div, k);
 		ans%=mod;

 		out.println(ans);

 		out.close();
 	}
	public static long[][] mul(long[][] m1, long[][] m2){
		long[][] ans = new long[y+1][y+1];
		for(int j =0;j<=y;j++){
			for(int k = 0;k<=y;k++){
				for(int l = 0;l<=y;l++){
					ans[j][l]+=m1[j][k]*m2[k][l];
					ans[j][l]%=mod;
				}
			}
		}
		return ans;
	}
	public static long[][] power(long[][] m1, long k){

		if (k == 0){
			long[][] mst = new long[y+1][y+1];
			for(int j =0 ;j<=y;j++){
				mst[j][j] = 1L;
			}
			return mst;
		}

		if (k == 1)
			return m1;
		long [][]ks = power(m1, k/2L);
		if (k%2 == 0)
			return mul(ks, ks);
		else
			return mul(mul(ks, ks), m1);
	}
	public static void sort(int[] array){
		ArrayList<Integer> copy = new ArrayList<Integer>();
		for (int i : array)
			copy.add(i);
		Collections.sort(copy);
		for(int i = 0;i<array.length;i++)
			array[i] = copy.get(i);
	}
	static String[] readArrayString(int n){
		String[] array = new String[n];
		for(int j =0 ;j<n;j++)
			array[j] = sc.next();
		return array;
	}
	static int[] readArrayInt(int n){
    	int[] array = new int[n];
    	for(int j = 0;j<n;j++)
    		array[j] = sc.nextInt();
    	return array;
    }
	static int[] readArrayInt1(int n){
		int[] array = new int[n+1];
		for(int j = 1;j<=n;j++){
			array[j] = sc.nextInt();
		}
		return array;
	}
	static long[] readArrayLong(int n){
		long[] array = new long[n];
		for(int j =0 ;j<n;j++)
			array[j] = sc.nextLong();
		return array;
	}
	static double[] readArrayDouble(int n){
		double[] array = new double[n];
		for(int j =0 ;j<n;j++)
			array[j] = sc.nextDouble();
		return array;
	}
	static int minIndex(int[] array){
		int minValue = Integer.MAX_VALUE;
		int minIndex = -1;
		for(int j = 0;j<array.length;j++){
			if (array[j] < minValue){
				minValue = array[j];
				minIndex = j;
			}
		}
		return minIndex;
	}
	static int minIndex(long[] array){
		long minValue = Long.MAX_VALUE;
		int minIndex = -1;
		for(int j = 0;j<array.length;j++){
			if (array[j] < minValue){
				minValue = array[j];
				minIndex = j;
			}
		}
		return minIndex;
	}
	static int minIndex(double[] array){
		double minValue = Double.MAX_VALUE;
		int minIndex = -1;
		for(int j = 0;j<array.length;j++){
			if (array[j] < minValue){
				minValue = array[j];
				minIndex = j;
			}
		}
		return minIndex;
	}
	static long power(long x, long y){
		if (y == 0)
			return 1;
		if (y%2 == 1)
			return (x*power(x, y-1))%mod;
		return power((x*x)%mod, y/2)%mod;
	}
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;
        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
        double nextDouble() {
            return Double.parseDouble(next());
        }
        String nextLine() {
            String str = "";
            try{
                str = br.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

    }
}

//StringJoiner sj = new StringJoiner(" ");
//sj.add(strings)
//sj.toString() gives string of those stuff w spaces or whatever that sequence is

//package com.company;
// Always comment out package when submitting.

import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {
    public static class Task {
        int mod = 1000000007;
        public class Frac {
            long a, b;

            public Frac(long a, long b) {
                this.a = a % mod;
                this.b = b % mod;
            }

            public Frac add(Frac other) {
                return new Frac(a * other.b + b * other.a, b * other.b);
            }

            public Frac mult(Frac other) {
                return new Frac(a * other.a, b * other.b);
            }

            public long toVal() {
                return a * BigInteger.valueOf(b).modInverse(BigInteger.valueOf(mod)).longValue() % mod;
            }

            @Override
            public String toString() {
                return a + "/" + b;
            }
        }
        int n;
        int minP0;
        int p0, p1;
        public Frac[][] matMul(Frac[][] m1, Frac[][] m2) {
            Frac[][] f = new Frac[n][n];
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    f[i][j] = new Frac(0, 1);
                }
            }
            for (int i = 0; i < n; i++) {
                for (int k = 0; k < n; k++) {
                    if (m1[i][k].a == 0) continue;
                    for (int j = 0; j < n; j++) {
                        f[i][j] = f[i][j].add(m1[i][k].mult(m2[k][j]));
                    }
                }
            }
            return f;
        }

        public Frac[][] pow(Frac[][] base, int cnt) {
            Frac[][] ret = new Frac[n][n];
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    ret[i][j] = new Frac(0, 1);
                }
                ret[i][i].a = 1;
            }
            while (cnt != 0) {
                if (cnt % 2 != 0) ret = matMul(ret, base);
                base = matMul(base, base);
                cnt >>= 1;
            }
            return ret;
        }

        public Frac[][] construct() {
            Frac[][] ret = new Frac[n][n];
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    ret[i][j] = new Frac(0, 1);
                }
            }
            long base = (long) (p0 + p1) * (p0 + p1 - 1) / 2;
            for (int i = minP0; i <= p0; i++) {
                int sum = 0;
                if (i > minP0) {
                    sum += i * (p1 - p0 + i);
                    ret[i - 1 - minP0][i - minP0] = new Frac(i * (p1 - p0 + i), base);
                }
                if (i + 1 - minP0 < n) {
                    sum += (p0 - i) * (p0 - i);
                    ret[i + 1 - minP0][i - minP0] = new Frac((p0 - i) * (p0 - i), base);
                }
                ret[i - minP0][i - minP0] = new Frac(base - sum, base);
            }
            return ret;
        }

        public void solve(Scanner sc, PrintWriter pw) throws IOException {
            n = sc.nextInt();
            int k = sc.nextInt();
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = sc.nextInt();
                if (arr[i] == 0) {
                    p0++;
                } else {
                    p1++;
                }
            }
            if (p1 >= p0) minP0 = 0;
            else minP0 = p0 - p1;
            n = p0 - minP0 + 1;
            int cnt0 = 0;
            for (int i = 0; i < p0; i++) {
                if (arr[i] == 0) cnt0++;
            }
            Frac[][] base = construct();
//            for (int i = 0; i < n; i++) {
//                for (int j = 0; j < n; j++) {
//                    System.err.print(base[i][j].toString() + " ");
//                }
//                System.err.println();
//            }
            Frac[][] powd = pow(base, k);
//            for (int i = 0; i < n; i++) {
//                for (int j = 0; j < n; j++) {
//                    System.err.print(powd[i][j].toString() + " ");
//                }
//                System.err.println();
//            }
            pw.println(powd[p0 - minP0][cnt0 - minP0].toVal());
        }
    }

    // template, actual code is in class Task.
    static long TIME_START, TIME_END;

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
//        Scanner sc = new Scanner(new FileInputStream("Test.in"));
        PrintWriter pw = new PrintWriter(new BufferedOutputStream(System.out));
//        PrintWriter pw = new PrintWriter(new FileOutputStream("Test.out"));

        Runtime runtime = Runtime.getRuntime();
        long usedMemoryBefore = runtime.totalMemory() - runtime.freeMemory();
        TIME_START = System.currentTimeMillis();
        Task t = new Task();
        t.solve(sc, pw);
        TIME_END = System.currentTimeMillis();
        long usedMemoryAfter = runtime.totalMemory() - runtime.freeMemory();
        pw.close();
//        System.err.println("Memory increased: " + (usedMemoryAfter - usedMemoryBefore) / 1000000);
//        System.err.println("Time used: " + (TIME_END - TIME_START) + ".");
    }

    // Faster IO with BufferedReader wrapped with Scanner
//    static class Scanner {
//        StringTokenizer st;
//        BufferedReader br;
//
//        public Scanner(InputStream s) {
//            br = new BufferedReader(new InputStreamReader(s));
//        }
//
//        public Scanner(FileReader s) throws FileNotFoundException {
//            br = new BufferedReader(s);
//        }
//
//        public String next() throws IOException {
//            while (st == null || !st.hasMoreTokens())
//                st = new StringTokenizer(br.readLine());
//            return st.nextToken();
//        }
//
//        public int nextInt() throws IOException {
//            return Integer.parseInt(next());
//        }
//
//        public long nextLong() throws IOException {
//            return Long.parseLong(next());
//        }
//
//        public String nextLine() throws IOException {
//            return br.readLine();
//        }
//
//        public double nextDouble() throws IOException {
//            return Double.parseDouble(next());
//        }
//
//        public boolean ready() throws IOException {
//            return br.ready();
//        }
//    }
}

//package round553;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class F {
	InputStream is;
	PrintWriter out;
	String INPUT = "";

	void solve()
	{
		int n = ni(), K = ni();
		int[] a = na(n);
		int o = 0;
		for(int i = 0;i < n;i++)o += a[i];
		int s = 0;
		for(int i = 0;i < o;i++)s += a[n-1-i];

		// o-i/n-o   i/o

		int[][] M = new int[o+1][o+1];
		long all = n*(n-1);

		long iall = invl(all, mod);
		for(int i = 0;i <= o;i++){
			for(int j = -1;j <= 1;j++){
				int t = i+j;
				if(t >= 0 && t <= o){
					if(j == 1){
						M[t][i] = (int)(2*(o-i)*(o-i)*iall%mod);
					}else if(j == -1){
						M[t][i] = (int)(2*((n-o)-(o-i))*i*iall%mod);
					}else{
						M[t][i] = (int)((all-2*(o-i)*(o-i)-2*((n-o)-(o-i))*i)*iall%mod);
					}
				}
			}
		}
		int[] v = new int[o+1];
		v[s] = 1;
		out.println(pow(M, v, K)[o]);
	}

	public static long invl(long a, long mod) {
		long b = mod;
		long p = 1, q = 0;
		while (b > 0) {
			long c = a / b;
			long d;
			d = a;
			a = b;
			b = d % b;
			d = p;
			p = q;
			q = d - c * q;
		}
		return p < 0 ? p + mod : p;
	}

	///////// begin
	public static final int mod = 1000000007;
	public static final long m2 = (long)mod*mod;
	public static final long BIG = 8L*m2;

	// A^e*v
	public static int[] pow(int[][] A, int[] v, long e)
	{
		for(int i = 0;i < v.length;i++){
			if(v[i] >= mod)v[i] %= mod;
		}
		int[][] MUL = A;
		for(;e > 0;e>>>=1) {
			if((e&1)==1)v = mul(MUL, v);
			MUL = p2(MUL);
		}
		return v;
	}

	// int matrix*int vector
	public static int[] mul(int[][] A, int[] v)
	{
		int m = A.length;
		int n = v.length;
		int[] w = new int[m];
		for(int i = 0;i < m;i++){
			long sum = 0;
			for(int k = 0;k < n;k++){
				sum += (long)A[i][k] * v[k];
				if(sum >= BIG)sum -= BIG;
			}
			w[i] = (int)(sum % mod);
		}
		return w;
	}

	// int matrix^2 (be careful about negative value)
	public static int[][] p2(int[][] A)
	{
		int n = A.length;
		int[][] C = new int[n][n];
		for(int i = 0;i < n;i++){
			long[] sum = new long[n];
			for(int k = 0;k < n;k++){
				for(int j = 0;j < n;j++){
					sum[j] += (long)A[i][k] * A[k][j];
					if(sum[j] >= BIG)sum[j] -= BIG;
				}
			}
			for(int j = 0;j < n;j++){
				C[i][j] = (int)(sum[j] % mod);
			}
		}
		return C;
	}

	void run() throws Exception
	{
		is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis()-s+"ms");
	}

	public static void main(String[] args) throws Exception { new F().run(); }

	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf){
			ptrbuf = 0;
			try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
	private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

	private double nd() { return Double.parseDouble(ns()); }
	private char nc() { return (char)skip(); }

	private String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b))){
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}

	private int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}

	private int ni()
	{
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl()
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private boolean oj = System.getProperty("ONLINE_JUDGE") != null;
	private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }
}

 //package Contest553;

import java.io.PrintWriter;
import java.util.Scanner;

public class mainF {
    public static Scanner enter = new Scanner(System.in);
    public static PrintWriter out = new PrintWriter(System.out);
    public static void main(String[] args) {
        long mod=(long)1e9+7;
        int n=enter.nextInt();
        long s=enter.nextLong();
        int[] arr=new int[n];
        int m=0;
        long CON=n*(n-1)/2;
        CON=bin_pow(CON,mod-2,mod);
        for (int i = 0; i <n ; i++) {
            arr[i]=enter.nextInt();
            m+=arr[i];
        }
        int f_k=0;
        for (int i = 0; i <n-m ; i++) {
            f_k+=arr[i];
        }
        int k=n-m;
        f_k=n-m-f_k;
        /*if(m<n-m){//Если нулей больше чем единиц
            k=m;
            f_k=n-m-f_k;
            m=n-m;
        }*/
        //f_k- кол-во нулей в первой части то есть это начальное состояние причём кол-во нулей меньше кол-ва единиц
        long[][] CM=new long[k+1][k+1];
        for (int i = Math.max(0,k-m); i <CM.length ; i++) {
            CM[i][i]=(1-(long)(i*(m-k+i)+(k-i)*(k-i))*CON);
            if(i<k) CM[i][i+1]=(long)(k-i)*(k-i)*CON;
            if(i>0)CM[i][i-1]=(long)i*(m-k+i)*CON;
        }
        MATRIX_mod(CM,mod);
        CM=bin_pow(CM,s,mod);
        System.out.println((CM[f_k][k]+mod)%mod);

    }
    public static long bin_pow(long a,long b, long mod){//a^b %mod
        long ans=1;
        while(b!=0){
            if((b&1)==1) ans*=a;
            a*=a;
            ans%=mod;
            a%=mod;
            b>>=1;
        }
        return ans;
    }

    public static long[][] bin_pow(long[][] a,long b, long mod){//a^b %mod
        long[][] ans=new long[a.length][a.length];
        for (int i = 0; i <ans.length ; i++) ans[i][i]=1;
        while(b!=0){
            if((b&1)==1) ans=MATRIX_mult(ans,a);
            a=MATRIX_mult(a,a);
            MATRIX_mod(ans,mod);
            MATRIX_mod(a,mod);
            b>>=1;
        }
        return ans;
    }
    public static long[][] MATRIX_mult(long[][] a, long[][] b) { //b не меняем a=a*b;
        long[][] c=new long[a.length][a.length];
        for (int i = 0; i <a.length ; i++) {
            for (int j = 0; j <a.length ; j++) {
                for (int k = 0; k <a.length ; k++) {
                    c[i][j]+=a[i][k]*b[k][j];
                    c[i][j]%=(long)(1e9+7);
                }
            }
        }
        return c;
    }
    public static void MATRIX_mod(long[][] a, long mod){
        for (int i = 0; i <a.length ; i++) {
            for (int j = 0; j <a.length ; j++) {
                a[i][j]%=mod;
            }
        }
    }
}

import java.util.*;
import java.io.*;
import java.math.BigInteger;
import static java.lang.Math.*;

/* spar5h */

public class cf6 implements Runnable {

	int x;
	long mod = (long)1e9 + 7;
	long[][] mat;

	long[][] multiply(long[][] a, long[][] b) {

		long[][] ret = new long[x + 1][x + 1];

		for(int i = 0; i <= x; i++)
			for(int j = 0; j <= x; j++)
				for(int k = 0; k <= x; k++)
					ret[i][j] = (ret[i][j] + a[i][k] * b[k][j] % mod) % mod;

		return ret;
	}

	long[][] matExp(int k) {

		if(k == 1)
			return mat;

		long[][] ret = matExp(k / 2);
		ret = multiply(ret, ret);

		if(k % 2 == 1)
			ret = multiply(ret, mat);

		return ret;
	}

	long modExp(long x, long y) {

		if(y == 1)
			return x;

		long ret = modExp(x, y / 2);

		ret = ret * ret % mod;

		if(y % 2 == 1)
			ret = ret * x % mod;

		return ret;
	}

	public void run() {

		InputReader s = new InputReader(System.in);
		PrintWriter w = new PrintWriter(System.out);

		int n = s.nextInt(), k = s.nextInt();

		int[] a = new int[n];
		x = 0;

		for(int i = 0; i < n; i++) {
			a[i] = s.nextInt();
			x += a[i];
		}

		int[] l = new int[2];
		int[] r = new int[2];

		for(int i = 0; i < x; i++)
			r[a[n - 1 - i]]++;

		for(int i = x; i < n; i++)
			l[a[n - 1 - i]]++;

		mat = new long[x + 1][x + 1];

		for(int i = 0; i <= x; i++) {

			mat[i][i] = n * (n - 1) / 2;

			if(x - i > n - x)
				continue;

			if(i - 1 >= 0) {
				mat[i - 1][i] = (n - x - (x - i)) * i;
				mat[i][i] -= mat[i - 1][i];
			}

			if(i + 1 <= x) {
				mat[i + 1][i] = (x - i) * (x - i);
				mat[i][i] -= mat[i + 1][i];
			}
		}

		w.println(matExp(k)[x][r[1]] * modExp(modExp(n * (n - 1) / 2, k), mod - 2) % mod);

		w.close();
	}

	static class InputReader {

		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int read() {

			if (numChars==-1)
				throw new InputMismatchException();

			if (curChar >= numChars) {

				curChar = 0;

				try {
					numChars = stream.read(buf);
				}
				catch (IOException e) {
					throw new InputMismatchException();
				}

				if(numChars <= 0)
					return -1;
			}

			return buf[curChar++];
		}

		public String nextLine() {

			BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
			String str = "";

			try {
	            str = br.readLine();
	        }
	        catch (IOException e) {
	            e.printStackTrace();
	        }

	        return str;
		}

		public int nextInt() {

			int c = read();

			while(isSpaceChar(c))
				c = read();

			int sgn = 1;

			if (c == '-') {
				sgn = -1;
				c = read();
			}

			int res = 0;

			do {
				if(c<'0'||c>'9')
					throw new InputMismatchException();

				res *= 10;
				res += c - '0';
				c = read();
			}
			while (!isSpaceChar(c));

			return res * sgn;
		}

		public long nextLong() {

			int c = read();

			while (isSpaceChar(c))
				c = read();

			int sgn = 1;

			if (c == '-') {
				sgn = -1;
				c = read();
			}

			long res = 0;

			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();

				res *= 10;
				res += c - '0';
				c = read();
			}

			while (!isSpaceChar(c));
				return res * sgn;
		}

		public double nextDouble() {

			int c = read();

			while (isSpaceChar(c))
				c = read();

			int sgn = 1;

			if (c == '-') {
				sgn = -1;
				c = read();
			}

			double res = 0;

			while (!isSpaceChar(c) && c != '.') {

				if (c == 'e' || c == 'E')
					return res * Math.pow(10, nextInt());

				if (c < '0' || c > '9')
					throw new InputMismatchException();

				res *= 10;
				res += c - '0';
				c = read();
			}

			if (c == '.') {

				c = read();
				double m = 1;
				while (!isSpaceChar(c))
				{
					if (c == 'e' || c == 'E')
						return res * Math.pow(10, nextInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}

			return res * sgn;
		}

		public String readString() {

			int c = read();

			while (isSpaceChar(c))
				c = read();

			StringBuilder res = new StringBuilder();

			do {
				res.appendCodePoint(c);
				c = read();
			}
			while (!isSpaceChar(c));

			return res.toString();
		}

		public boolean isSpaceChar(int c) {

			if (filter != null)
				return filter.isSpaceChar(c);

			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public String next() {
			return readString();
		}

		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}

	}

	public static void main(String args[]) throws Exception {
		new Thread(null, new cf6(),"cf6",1<<26).start();
	}
}

import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) throws Exception {

        new Main().go();
    }

    PrintWriter out;
    Reader in;
    BufferedReader br;

    Main() throws IOException {

        try {

            //br = new BufferedReader( new FileReader("input.txt") );
            //in = new Reader("input.txt");
            in = new Reader("input.txt");
            out = new PrintWriter( new BufferedWriter(new FileWriter("output.txt")) );
        }
        catch (Exception e) {

            //br = new BufferedReader( new InputStreamReader( System.in ) );
            in = new Reader();
            out = new PrintWriter( new BufferedWriter(new OutputStreamWriter(System.out)) );
        }
    }

    void go() throws Exception {

        //int t = in.nextInt();
        int t = 1;
        while (t > 0) {
            solve();
            t--;
        }

        out.flush();
        out.close();
    }

    int inf = 2000000000;
    int mod = 1000000007;
    double eps = 0.000000001;

    int n;
    int m;

    ArrayList<Pair>[] g;
    void solve() throws IOException {

        int n = in.nextInt();
        int k = in.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = in.nextInt();

        int cnt1 = 0;
        for (int i = 0; i < n; i++) {
            cnt1 += a[i];
        }

        int cnt0 = n - cnt1;
        int pref1 = 0;

        for (int i = 0; i < cnt0; i++)
            pref1 += a[i];

        int pref0 = cnt0 - pref1;

        int[][] cost = new int[n + 1][n + 1];
        for (int i = 0; i <= n; i++) {

            if (i > cnt0) continue;

            cost[i][i] = cnt1 * (cnt1 - 1) / 2;
            cost[i][i] += cnt0 * (cnt0 - 1) / 2;
            cost[i][i] += i * (cnt0 - i);
            cost[i][i] += (cnt0 - i) * (cnt1 - (cnt0 - i));
            if (i - 1 >= 0) {
                int cnt = cnt0 - (i - 1);
                if (cnt <= cnt1)
                    cost[i - 1][i] = cnt * cnt;
            }

            if (i + 1 <= cnt0) {
                int onesPref = cnt0 - (i + 1);
                int onesSuf = cnt1 - onesPref;
                if (onesPref + onesSuf == cnt1)
                    cost[i + 1][i] = (i + 1) * onesSuf;
            }
        }

        int[][] c = pow(cost, k);
        int[] d = new int[n + 1];
        d[pref0] = 1;

        int[] res = new int[n + 1];
        for (int i = 0; i <= n; i++)
            for (int j = 0; j <= n; j++)
                res[i] = (res[i] + d[j] * c[j][i]) % mod;

        long sum = 0;
        for (int i = 0; i <= n; i++)
            sum = (sum + res[i]) % mod;

        System.err.println(res[cnt0]);

        long ans = (long) res[cnt0] * pow(sum, mod - 2);
        ans %= mod;
        out.println(ans);
    }

    int[][] mult(int[][] a, int[][] b) {
        int n = a[0].length;
        int[][] c = new int[n][n];
        for (int i = 0; i < n; i++)
            for (int j = 0; j < n; j++)
                for (int k = 0; k < n; k++)
                    c[i][j] = (int)((c[i][j] + (long) a[i][k] * b[k][j]) % mod);
        return c;
    }

    int[][] pow(int[][] a, int n) {
        if (n == 1)
            return a;
        if (n % 2 == 1)
            return mult(a, pow(a, n - 1));
        int[][] res = pow(a, n / 2);
        return mult(res, res);
    }

    long pow(long x, int n) {
        if (n == 0)
            return 1;
        if (n % 2 == 1)
            return (x * pow(x, n - 1)) % mod;
        long res = pow(x, n / 2);
        return (res * res) % mod;
    }

    class Pair implements Comparable<Pair> {

        int a;
        int b;

        Pair(int a, int b) {
            this.a = a;
            this.b = b;
        }

        public int compareTo(Pair p) {
            if (a != p.a)
                return Integer.compare(a, p.a);
            else
                return Integer.compare(b, p.b);
        }
    }

    class Item {

        int a;
        int b;
        int c;

        Item(int a, int b, int c) {
            this.a = a;
            this.b = b;
            this.c = c;
        }

    }

    class Reader {

        BufferedReader  br;
        StringTokenizer tok;

        Reader(String file) throws IOException {
            br = new BufferedReader( new FileReader(file) );
        }

        Reader() throws IOException {
            br = new BufferedReader( new InputStreamReader(System.in) );
        }

        String next() throws IOException {

            while (tok == null || !tok.hasMoreElements())
                tok = new StringTokenizer(br.readLine());
            return tok.nextToken();
        }

        int nextInt() throws NumberFormatException, IOException {
            return Integer.valueOf(next());
        }

        long nextLong() throws NumberFormatException, IOException {
            return Long.valueOf(next());
        }

        double nextDouble() throws NumberFormatException, IOException {
            return Double.valueOf(next());
        }

        String nextLine() throws IOException {
            return br.readLine();
        }

    }

    static class InputReader
    {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public InputReader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public InputReader(String file_name) throws IOException
        {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException
        {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            }  while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');

            if (c == '.')
            {
                while ((c = read()) >= '0' && c <= '9')
                {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }
    }

}

import java.io.*;
import java.util.*;

public class Main implements Runnable{
    public static void main(String[] args){
        //new Thread(null,new Main(),"Thread-1",1024*1024*10).start();
        new Main().run();
    }
    int[]a;
    int tot=0;
    long[]inv;
    int mod=1000000007;
    private void solve() throws Exception {
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        int n=in.nextInt(),k=in.nextInt();
        a=new int[n];
        inv=getInvs(10000,mod);
        for(int i=0;i<n;i++){
            a[i]=in.nextInt();
            if(a[i]==1)tot++;
        }
        int where=0;
        for(int i=0;i<n-tot;i++){
            if(a[i]==1)where++;
        }
        int len=Math.min(n-tot,tot);
        long[][]matrix=new long[len+1][len+1];
        long all=(long)n*(n-1)*inv[2]%mod;
        long invall=inv[(int)all];
        for(int i=0;i<=len;i++){
            long cnt=0;
            if(i>0){
                matrix[i-1][i]=i*i*invall%mod;
                cnt+=i*i;
            }
            if(i<len){
                matrix[i+1][i]=(tot-i)*(n-tot-i)*invall%mod;
                cnt+=(tot-i)*(n-tot-i);
            }
            matrix[i][i]=((all-cnt)%mod+mod)%mod*invall%mod;
        }
        long[][]ans=pow(matrix,k);
        out.println(ans[0][where]);
        out.flush();
    }
    public long[][]pow(long[][]a,int b){
        long[][]ans=new long[a.length][a.length];
        for(int i=0;i<a.length;i++)ans[i][i]=1;
        while(b>0){
            if((b&1)==1)ans=modMul(ans,a);
            a=modMul(a,a);
            b>>=1;
        }
        return ans;
    }
    public long[][] modMul(long[][]a,long[][]b){
        int row=a.length,column=b[0].length;
        int len=b.length;
        long[][] ans=new long[row][column];
        for(int i=0;i<row;i++){
            for(int j=0;j<len;j++){
                if(a[i][j]==0)continue;//稀疏矩阵优化
                for(int k=0;k<column;k++){
                    ans[i][k]+=a[i][j]*b[j][k]%mod;
                    ans[i][k]%=mod;
                }
            }
        }
        return ans;
    }
    public static long[] getInvs(int n,int mod){
        long[]inv=new long[n+1];
        inv[1]=1;
        for(int i=2;i<inv.length;i++)
            inv[i]=(mod-mod/i)*inv[mod%i]%mod;
        return inv;
    }
    @Override
    public void run() {
        try {
            solve();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    class InputReader{
        StreamTokenizer tokenizer;
        public InputReader(InputStream stream){
            tokenizer=new StreamTokenizer(new BufferedReader(new InputStreamReader(stream)));
            tokenizer.ordinaryChars(33,126);
            tokenizer.wordChars(33,126);
        }
        public String next() throws IOException {
            tokenizer.nextToken();
            return tokenizer.sval;
        }
        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }
        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }
        public boolean hasNext() throws IOException {
            int res=tokenizer.nextToken();
            tokenizer.pushBack();
            return res!=tokenizer.TT_EOF;
        }
    }
}

import java.io.*;
import java.util.*;

public class Main implements Runnable{
    public static void main(String[] args){
        //new Thread(null,new Main(),"Thread-1",1024*1024*10).start();
        new Main().run();
    }
    int[]a;
    int tot=0;
    long[]inv;
    int mod=1000000007;
    private void solve() throws Exception {
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        int n=in.nextInt(),k=in.nextInt();
        a=new int[n];
        inv=getInvs(10000,mod);
        for(int i=0;i<n;i++){
            a[i]=in.nextInt();
            if(a[i]==1)tot++;
        }
        int where=0;
        for(int i=0;i<n-tot;i++){
            if(a[i]==1)where++;
        }
        int len=Math.min(n-tot,tot);
        long[][]matrix=new long[len+1][len+1];
        long all=(long)n*(n-1)*inv[2]%mod;
        long invall=inv[(int)all];
        for(int i=0;i<=len;i++){
            long cnt=0;
            if(i>0){
                matrix[i-1][i]=i*i*invall%mod;
                cnt+=i*i;
            }
            if(i<len){
                matrix[i+1][i]=(tot-i)*(n-tot-i)*invall%mod;
                cnt+=(tot-i)*(n-tot-i);
            }
            matrix[i][i]=((all-cnt)%mod+mod)%mod*invall%mod;
        }
        long[][]ans=pow(matrix,k);
        out.println(ans[0][where]);
        out.flush();
    }
    public long[][]pow(long[][]a,int b){
        long[][]ans=new long[a.length][a.length];
        for(int i=0;i<a.length;i++)ans[i][i]=1;
        while(b>0){
            if((b&1)==1)ans=modMul(ans,a);
            a=modMul(a,a);
            b>>=1;
        }
        return ans;
    }
    public long[][] modMul(long[][]a,long[][]b){
        int row=a.length,column=b[0].length;
        int len=b.length;
        long[][] ans=new long[row][column];
        for(int i=0;i<row;i++){
            for(int j=0;j<len;j++){
                //if(a[i][j]==0)continue;//稀疏矩阵优化
                for(int k=0;k<column;k++){
                    ans[i][k]+=a[i][j]*b[j][k]%mod;
                    ans[i][k]%=mod;
                }
            }
        }
        return ans;
    }
    public static long[] getInvs(int n,int mod){
        long[]inv=new long[n+1];
        inv[1]=1;
        for(int i=2;i<inv.length;i++)
            inv[i]=(mod-mod/i)*inv[mod%i]%mod;
        return inv;
    }
    @Override
    public void run() {
        try {
            solve();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    class InputReader{
        StreamTokenizer tokenizer;
        public InputReader(InputStream stream){
            tokenizer=new StreamTokenizer(new BufferedReader(new InputStreamReader(stream)));
            tokenizer.ordinaryChars(33,126);
            tokenizer.wordChars(33,126);
        }
        public String next() throws IOException {
            tokenizer.nextToken();
            return tokenizer.sval;
        }
        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }
        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }
        public boolean hasNext() throws IOException {
            int res=tokenizer.nextToken();
            tokenizer.pushBack();
            return res!=tokenizer.TT_EOF;
        }
    }
}

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static long MOD = 1000000007;

    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();
        final int k = scanner.nextInt();

        final ArrayList<Integer> values = new ArrayList<>(n);
        for (int i = 0; i < n; i++) {
            values.add(scanner.nextInt());
        }

        final int zeroCount = values.stream().filter(integer -> integer.equals(0)).mapToInt(i -> 1).sum();
        final int oneCount = n - zeroCount;
        final int size = Math.min(zeroCount, oneCount);

        long[][] table = new long[size + 1][size + 1];

        int diff = 0;
        for (int i = 0; i < n; i++) {
            if (values.get(i) == 0 && i >= zeroCount) {
                diff++;
            }
        }

        final int allPosible = (n * (n - 1)) / 2;
        final long allPosibleInverse = binPow(allPosible, MOD - 2);
        for (int i = 0; i < size + 1; i++) {
            for (int j = 0; j < size + 1; j++) {

                if (i - j == 1) {
                    table[i][j] = i * i * allPosibleInverse;
                }

                if (i - j == 0) {
                    table[i][j] = (allPosible - i * i - (zeroCount - i) * (oneCount - i)) * allPosibleInverse;
                }

                if (i - j == -1) {
                    table[i][j] = (zeroCount - i) * (oneCount - i) * allPosibleInverse;
                }
                table[i][j] = table[i][j] % MOD;
            }
        }

        table = binPow(table, k);

//        for (long[] longs : table) {
//            for (long value : longs) {
//                System.out.printf("%10d", value);
//            }
//            System.out.println();
//        }

        System.out.println(table[diff][0]);
    }

    private static long binPow(long n, long count) {
        if (count == 0) {
            return 1L;
        }

        long temp = binPow(n, count / 2);
        temp = (temp * temp) % MOD;
        if (count % 2 != 0) {
            temp = (temp * n) % MOD;
        }

        return temp % MOD;
    }

    private static long[][] binPow(long[][] table, long count) {
        if (count == 0) {
            final long[][] ans = new long[table.length][table.length];
            for (int i = 0; i < table.length; i++) {
                ans[i][i] = 1;
            }
            return ans;
        }

        long[][] temp = binPow(table, count / 2);
        temp = (mul(temp, temp));
        if (count % 2 != 0) {
            temp = mul(temp, table);
        }

        return temp;
    }

    private static long[][] mul(long[][] a, long[][] b) {
        final long[][] ans = new long[a.length][a.length];
        for (int i = 0; i < a.length; i++) {
            for (int j = 0; j < a.length; j++) {
                for (int k = 0; k < a.length; k++) {
                    ans[i][j] += (a[i][k] * b[k][j]) % MOD;
                    ans[i][j] = ans[i][j] % MOD;
                }
            }
        }
        return ans;
    }
}

import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashSet;
import java.util.NoSuchElementException;
import java.util.Objects;
import java.util.PriorityQueue;
import java.util.TreeSet;
import java.util.function.BiFunction;

public class Main{
	static int n;
	static int mod = 1000000007;
	static long[][] A;
	public static void main(String[] args){
		FastScanner sc = new FastScanner();
		Mathplus mp = new Mathplus();
		PrintWriter out = new PrintWriter(System.out);

		n = sc.nextInt();
		int k = sc.nextInt();
		int num = 0;
		int[] a = new int[n];
		for(int i=0;i<n;i++){
			a[i] = sc.nextInt();
			num+=a[i];
		}
		int d = 0;
		for(int i=0;i<n-num;i++){
			if(a[i]==1) d ++;
		}
		long alle = n*(n-1)/2;
		long mot = mp.rev(alle);
		A = new long[n+1][n+1];
		for(int i=0;i<=n;i++){
			if(i!=0){
				A[i][i-1] = i * i * mot%mod;
			}
			if(i!=n){
				A[i][i+1] =Math.max(0,(n-num-i)) * Math.max(0,num-i) * mot % mod;
			}
			A[i][i] = Math.max(alle - i * i-Math.max(0,n-num-i) * Math.max(0,num-i),0)*mot%mod;
		}
		long[][] ans = pow(A,k);
		for(int i=0;i<=n;i++){
			for(int j=0;j<=n;j++){
				if(A[i][j]<0){
					System.out.println("out"+i+" "+j);
				}
			}
		}
		System.out.println(ans[d][0]);
	}
	private static long[][] pow(long[][] a2, long k) {
		if(k==1){
			return a2;
		}else{
			if(k%2==0){
				long[][] val = pow(a2,k/2);
				return mul(val,val);
			}else{
				return mul(pow(a2,k-1),A);
			}
		}
	}
	private static long[][] mul(long[][] a, long[][] b) {
		long[][] c = new long[n+1][n+1];
		for(int i=0;i<n+1;i++){
			for(int j=0;j<n+1;j++){
				for(int k=0;k<n+1;k++){
					c[i][j] += a[i][k] * b[k][j];
					c[i][j] %= mod;
				}
			}
		}
		return c;
	}

}

class SegmentTree<T,E>{
	int N;
	BiFunction<T,T,T> f;
	BiFunction<T,E,T> g;
	T d1;
	ArrayList<T> dat;
	SegmentTree(BiFunction<T,T,T> F,BiFunction<T,E,T> G,T D1,T[] v){
		int n = v.length;
		f = F;
		g = G;
		d1 = D1;
		init(n);
		build(v);
	}

	void init(int n) {
		N = 1;
		while(N<n)N*=2;
		dat = new ArrayList<T>();
	}

	void build(T[] v) {
		for(int i=0;i<2*N;i++) {
			dat.add(d1);
		}
		for(int i=0;i<v.length;i++) {
			dat.set(N+i-1,v[i]);
		}
		for(int i=N-2;i>=0;i--) {
			dat.set(i,f.apply(dat.get(i*2+1),dat.get(i*2+2)));
		}
	}

	void update(int k,E a) {
		k += N-1;
		dat.set(k,g.apply(dat.get(k),a));
		while(k>0){
			k = (k-1)/2;
			dat.set(k,f.apply(dat.get(k*2+1),dat.get(k*2+2)));
		}
	}

	T query(int a,int b, int k, int l ,int r) {
		if(r<=a||b<=l) return d1;
		if(a<=l&&r<=b) return dat.get(k);
		T vl = query(a,b,k*2+1,l,(l+r)/2);
		T vr = query(a,b,k*2+2,(l+r)/2,r);
		return f.apply(vl, vr);
	}
	T query(int a,int b){
		return query(a,b,0,0,N);
	}

}

class LazySegmentTree<T,E> extends SegmentTree<T,E>{
	BiFunction<E,E,E> h;
	BiFunction<E,Integer,E> p = (E a,Integer b) ->{return a;};
	E d0;
	ArrayList<E> laz;
	LazySegmentTree(BiFunction<T,T,T> F,BiFunction<T,E,T> G,BiFunction<E,E,E> H,T D1,E D0,T[] v){
		super(F,G,D1,v);
		int n = v.length;
		h = H;
		d0 = D0;
		Init(n);
	}
	void build() {

	}
	void Init(int n){
		laz = new ArrayList<E>();
		for(int i=0;i<2*N;i++) {
			laz.add(d0);
		}
	}

	void eval(int len,int k) {
		if(laz.get(k).equals(d0)) return;
		if(k*2+1<N*2-1) {
			laz.set(k*2+1,h.apply(laz.get(k*2+1),laz.get(k)));
			laz.set(k*2+2,h.apply(laz.get(k*2+2),laz.get(k)));
		}
		dat.set(k,g.apply(dat.get(k), p.apply(laz.get(k), len)));
		laz.set(k,d0);
	}

	T update(int a,int b,E x,int k,int l,int r) {
		eval(r-l,k);
		if(r<=a||b<=l) {
			return dat.get(k);
		}
		if(a<=l&&r<=b) {
			laz.set(k,h.apply(laz.get(k),x));
			return g.apply(dat.get(k),p.apply(laz.get(k),r-l));
		}
		T vl = update(a,b,x,k*2+1,l,(l+r)/2);
		T vr = update(a,b,x,k*2+2,(l+r)/2,r);
		dat.set(k,f.apply(vl,vr));
		return dat.get(k);

	}

	T update(int a,int b,E x) {
		return update(a,b,x,0,0,N);
	}

	T query(int a,int b,int k,int l,int r) {
		eval(r-l,k);
		if(r<=a||b<=l) return d1;
		if(a<=l&&r<=b) return dat.get(k);
		T vl = query(a,b,k*2+1,l,(l+r)/2);
		T vr = query(a,b,k*2+2,(l+r)/2,r);
		return f.apply(vl, vr);
	}

	T query(int a,int b){
		return query(a,b,0,0,N);
	}

}
class UnionFindTree {
	int[] root;
	int[] rank;
	int[] size;
	UnionFindTree(int N){
		root = new int[N];
		rank = new int[N];
		size = new int[N];
		for(int i=0;i<N;i++){
			root[i] = i;
			size[i] = 1;
		}
	}

	public int find(int x){
		if(root[x]==x){
			return x;
		}else{
			return find(root[x]);
		}
	}

	public void unite(int x,int y){
		x = find(x);
		y = find(y);
		if(x==y){
			return;
		}else{
			if(rank[x]<rank[y]){
				root[x] = y;
				size[y] += size[x];
			}else{
				root[y] = x;
				size[x] += size[y];
				if(rank[x]==rank[y]){
					rank[x]++;
				}
			}
		}
	}

	public boolean same(int x,int y){
		return find(x)==find(y);
	}

}

class ParticalEternalLastingUnionFindTree extends UnionFindTree{
	int[] time;
	int now;
	ParticalEternalLastingUnionFindTree(int N){
		super(N);
		time = new int[N];
		for(int i=0;i<N;i++) {
			time[i] = 1000000007;
		}
	}

	public int find(int t,int i) {
		if(time[i]>t) {
			return i;
		}else {
			return find(t,root[i]);
		}
	}

	public void unite(int x,int y,int t) {
		now = t;
		x = find(t,x);
		y = find(t,y);
		if(x==y)return;
		if(rank[x]<rank[y]){
			root[x] = y;
			size[y] += size[x];
			time[x] = t;
		}else{
			root[y] = x;
			size[x] += size[y];
			if(rank[x]==rank[y]){
				rank[x]++;
			}
			time[y] = t;
		}
	}

	public int sametime(int x,int y) {
		if(find(now,x)!=find(now,y)) return -1;
		int ok = now;
		int ng = 0;
		while(ok-ng>1) {
			int mid = (ok+ng)/2;
			if(find(mid,x)==find(mid,y)) {
				ok = mid;
			}else {
				ng = mid;
			}
		}
		return ok;
	}

}
class Graph {
	ArrayList<Edge>[] list;
	int size;

	TreeSet<LinkEdge> Edges = new TreeSet<LinkEdge>(new LinkEdgeComparator());

	@SuppressWarnings("unchecked")
	Graph(int N){
		size = N;
		list = new ArrayList[N];
		for(int i=0;i<N;i++){
			list[i] = new ArrayList<Edge>();
		}
	}

	void addEdge(int a,int b){
		list[a].add(new Edge(b,1));
	}

	void addWeightedEdge(int a,int b,long c){
		list[a].add(new Edge(b,c));
	}

	void addEgdes(int[] a,int[] b){
		int size = a.length;
		for(int i=0;i<size;i++){
			list[a[i]].add(new Edge(b[i],1));
		}
	}

	void addWeighterEdges(int[] a ,int[] b ,int[] c){
		int size = a.length;
		for(int i=0;i<size;i++){
			list[a[i]].add(new Edge(b[i],c[1]));
		}
	}

	long[] bfs(int s){
		long[] L = new long[size];
		for(int i=0;i<size;i++){
			L[i] = -1;
		}
		L[s] = 0;
		ArrayDeque<Integer> Q = new ArrayDeque<Integer>();
		Q.add(s);

		while(!Q.isEmpty()){
			int v = Q.poll();
			for(Edge e:list[v]){
				int w = e.to;
				long c = e.cost;
				if(L[w]==-1){
					L[w] = L[v] + c;
					Q.add(w);
				}
			}
		}

		return L;
	}

	long[] dijkstra(int s){
		long[] L = new long[size];
		for(int i=0;i<size;i++){
			L[i] = -1;
		}
		int[] visited = new int[size];
		L[s] = 0;
		PriorityQueue<Pair> Q = new PriorityQueue<Pair>(new SampleComparator());
		Q.add(new Pair(0,s));

		while(!Q.isEmpty()){

			Pair C = Q.poll();
			if(visited[(int)C.b]==0){
				L[(int)C.b] = C.a;
				visited[(int) C.b] = 1;
				for(Edge D:list[(int) C.b]){
					Q.add(new Pair(L[(int)C.b]+D.cost,D.to));
				}
			}
		}

		return L;
	}
	long[] maxtra(int s,long l){
		long[] L = new long[size];
		for(int i=0;i<size;i++){
			L[i] = -1;
		}
		int[] visited = new int[size];
		L[s] = -1;
	;
		PriorityQueue<Pair> Q = new PriorityQueue<Pair>(new SampleComparator());
		Q.add(new Pair(l,s));

		while(!Q.isEmpty()){

			Pair C = Q.poll();
			if(visited[(int)C.b]==0){
				L[(int)C.b] = C.a;
				visited[(int) C.b] = 1;
				for(Edge D:list[(int) C.b]){
					Q.add(new Pair(Math.max(L[(int)C.b],D.cost),D.to));
				}
			}
		}

		return L;
	}
	long Kruskal(){
		long ans = 0;
		for(int i=0;i<size;i++) {
			for(Edge e:list[i]) {
				Edges.add(new LinkEdge(e.cost,i,e.to));
			}
		}
		UnionFindTree UF = new UnionFindTree(size);
		for(LinkEdge e:Edges){
			if(e.a>=0&&e.b>=0) {
				if(!UF.same(e.a,e.b)){
					ans += e.L;
					UF.unite(e.a,e.b);
				}
			}
		}

		return ans;
	}

	ArrayList<Integer> Kahntsort(){

		ArrayList<Integer> ans = new ArrayList<Integer>();
		PriorityQueue<Integer> q = new PriorityQueue<Integer>();
		int[] in = new int[size];
		for(int i=0;i<size;i++) {
			for(Edge e:list[i]) {
				in[e.to]++;
			}
		}
		for(int i=0;i<size;i++) {
			if(in[i]==0) {
				q.add(i);
			}
		}
		while(!q.isEmpty()) {
			int v = q.poll();
			ans.add(v);
			for(Edge e:list[v]) {
				in[e.to]--;
				if(in[e.to]==0) {
					q.add(e.to);
				}
			}
		}
		for(int i=0;i<size;i++) {
			if(in[i]>0)return new ArrayList<Integer>();
		}
		return ans;
	}

	RootedTree dfsTree(int i) {
		int[] used = new int[size];
		RootedTree r = new RootedTree(size);
		dfsTree(i,used,r);
		return r;

	}

	private void dfsTree(int i, int[] used, RootedTree r) {
		used[i] = 1;
		for(Edge e:list[i]) {
			if(used[e.to]==0) {
				r.list[i].add(e);
				used[e.to] = 1;
				dfsTree(i,used,r);
			}
		}

	}
}

class Tree extends Graph{

	public Tree(int N) {
		super(N);
	}

	long[] tyokkei(){
		long[] a = bfs(0);

		System.out.println();
		int maxdex = -1;
		long max = 0;
		for(int i=0;i<size;i++){
			if(max<a[i]){
				max = a[i];
				maxdex = i;
			}
		}

		long[] b = bfs(maxdex);
		System.out.println();
		int maxdex2 = -1;
		long max2 = 0;
		for(int i=0;i<size;i++){
			if(max2<b[i]){
				max2 = b[i];
				maxdex2 = i;
			}
		}
		long[] ans = {max2,maxdex,maxdex2};
		return ans;
	}

}

class RootedTree extends Graph{

	RootedTree(int N){
		super(N);
	}

}
class LinkEdge{
	long L;
	int a ;
	int b;
	LinkEdge(long l,int A,int B){
		L = l;
		a = A;
		b = B;
	}
	public boolean equals(Object o){
		LinkEdge O = (LinkEdge) o;
		if(O.a==this.a&&O.b==this.b&&O.L==this.L){
			return true;
		}else{
			return false;
		}

	}

	public int hashCode(){
		return Objects.hash(L,a,b);
	}

}

class Edge{
	int to;
	long cost;

	Edge(int a,long b){
		to = a;
		cost = b;
	}

}
class LinkEdgeComparator implements Comparator<LinkEdge>{
	public int compare(LinkEdge P, LinkEdge Q) {
		long temp = P.L-Q.L;
		if(temp==0){
			if(P.a>Q.a){
				return 1;
			}else{
				if(P.b>Q.b){
					return 1;
				}else{
					return -1;
				}
			}

		}
		if(temp>=0){
			return 1;
		}else{
			return -1;
		}
	}

}
class Pair{
	long a;
	long b;

	Pair(long p,long q){
		this.a = p;
		this.b = q;
	}

	public boolean equals(Object o){
		Pair O = (Pair) o;
		if(O.a==this.a&&O.b==this.b){
			return true;
		}else{
			return false;
		}

	}

	public int hashCode(){
		return Objects.hash(a,b);
	}

}

class SampleComparator implements Comparator<Pair>{
	public int compare(Pair P, Pair Q) {
		long temp = P.a-Q.a;
		if(temp==0){
			if(P.b>Q.b){
				return 1;
			}else{
				return -1;
			}

		}
		if(temp>=0){
			return 1;
		}else{
			return -1;
		}
	}

}

class LongIntPair{
	long a;
	int b;

	LongIntPair(long p,int q){
		this.a = p;
		this.b = q;
	}

	public boolean equals(Object o){
		Pair O = (Pair) o;
		if(O.a==this.a&&O.b==this.b){
			return true;
		}else{
			return false;
		}

	}

	public int hashCode(){
		return Objects.hash(a,b);
	}

}

class LongIntSampleComparator implements Comparator<LongIntPair>{
	public int compare(LongIntPair P, LongIntPair Q) {
		long temp = P.a-Q.a;
		if(temp==0){
			if(P.b>Q.b){
				return 1;
			}else{
				return -1;
			}

		}
		if(temp>=0){
			return 1;
		}else{
			return -1;
		}
	}

}

class FastScanner {
    private final java.io.InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
    public boolean hasNext() { skipUnprintable(); return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return (minus ? -n : n);
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return (int) (minus ? -n : n);
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
}

class Mathplus{
	int mod = 1000000007;
	long[] fac = new long[1000001];
	long[][] combt = new long[2001][2001];
	long[][] permt = new long[2001][2001];
	boolean isBuild = false;
	boolean isBuildc = false;
	boolean isBuildp = false;
	int mindex = -1;
	int maxdex = -1;

	void buildFac(){
		fac[0] = 1;
		for(int i=1;i<=1000000;i++){
			fac[i] = (fac[i-1] * i)%mod;
		}
		isBuild = true;
	}

	void buildComb() {
		for(int i=0;i<=2000;i++) {
			combt[i][0] = 1;
		}
		for(int j=1;j<=2000;j++) {
			combt[j][j] = 1;
			for(int i=j+1;i<=2000;i++) {
				combt[i][j] = combt[i-1][j-1] + combt[i-1][j];
				if(combt[i][j]>=mod)combt[i][j]-=mod;
			}

		}
		isBuildc = false;
	}

	void buildPerm() {
		for(int i=0;i<=2000;i++) {
			permt[i][0] = 1;
		}
		if(!isBuild)buildFac();
		for(int i=1;i<=2000;i++) {
			for(int j=1;j<=i;j++) {
				permt[i][j] = permt[i][j-1]*(i-j+1);
				permt[i][j] %= mod;
			}
		}
		isBuildp = true;
	}

	public int isBigger(int[] d, int i) {
		int ok = d.length;
		int ng = -1;
		while(Math.abs(ok-ng)>1) {
			int mid = (ok+ng)/2;
			if(d[mid]>i) {
				ok = mid;
			}else {
				ng = mid;
			}
		}
		return ok;
	}

	public int isSmaller(int[] d, int i) {
		int ok = -1;
		int ng = d.length;
		while(Math.abs(ok-ng)>1) {
			int mid = (ok+ng)/2;
			if(d[mid]<i) {
				ok = mid;
			}else {
				ng = mid;
			}
		}
		return ok;
	}

	public HashSet<Integer> primetable(int m) {
		HashSet<Integer> pt = new HashSet<Integer>();
		for(int i=2;i<=m;i++) {
			boolean b = true;
			for(int d:pt) {
				if(i%d==0) {
					b = false;
					break;
				}
			}
			if(b) {
				pt.add(i);
			}
		}
		return pt;
	}

	long max(long[] a){
		long max = 0;
		for(int i=0;i<a.length;i++){
			if(max<a[i]){
				max =a[i];
				maxdex = i;
			}
		}
		return max;
	}
	int max(int[] a){
		int max = 0;
		for(int i=0;i<a.length;i++){
			if(max<a[i]){
				max =a[i];
				maxdex = i;
			}
		}
		return max;
	}
	long min(long[] a){
		long min = Long.MAX_VALUE;
		for(int i=0;i<a.length;i++){
			if(min>a[i]){
				min =a[i];
				mindex = i;
			}
		}
		return min;
	}
	int min(int[] a){
		int min = Integer.MAX_VALUE;
		for(int i=0;i<a.length;i++){
			if(min>a[i]){
				min =a[i];
				mindex = i;
			}
		}
		return min;
	}
	long sum(long[] a){
		long sum = 0;
		for(int i=0;i<a.length;i++){
			sum += a[i];
		}
		return sum;
	}
	long sum(int[] a){
		long sum = 0;
		for(int i=0;i<a.length;i++){
			sum += a[i];
		}
		return sum;
	}

	long gcd(long a, long b){
		if(a<b){
			a^=b;
			b^=a;
			a^=b;
		}
		if(a%b==0){
			return b;
		}else{
			return gcd(b,a%b);
		}
	}

	long lcm(long a, long b){
		return a / gcd(a,b) * b;
	}

	public long perm(int a,int num) {
		if(a<2000&&num<2000) {
			if(!isBuildp) {
				buildPerm();
				isBuildp = true;
 			}
			return permt[a][num];
		}
		if(!isBuild) {
			buildFac();
		}
		return fac[a] * (rev(fac[a-num]))%mod;
	}
	public long comb(int a,int num){
		if(a<2000&&num<2000) {
			if(!isBuildc) {
				buildComb();
				isBuildc = true;
 			}
			return combt[a][num];
		}
		if(!isBuild){
			buildFac();
		}
		return fac[a] * (rev(fac[num])*rev(fac[a-num])%mod)%mod;
	}

	long rev(long l) {
		return pow(l,mod-2);
	}

	long pow(long l, int i) {
		if(i==0){
			return 1;
		}else{
			if(i%2==0){
				long val = pow(l,i/2);
				return val * val % mod;
			}else{
				return pow(l,i-1) * l % mod;
			}
		}
	}

}

import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashSet;
import java.util.NoSuchElementException;
import java.util.Objects;
import java.util.PriorityQueue;
import java.util.TreeSet;
import java.util.function.BiFunction;

public class Main{
	static int n;
	static int mod = 1000000007;
	static long[][] A;
	public static void main(String[] args){
		FastScanner sc = new FastScanner();
		Mathplus mp = new Mathplus();
		PrintWriter out = new PrintWriter(System.out);

		n = sc.nextInt();
		int k = sc.nextInt();
		int num = 0;
		int[] a = new int[n];
		for(int i=0;i<n;i++){
			a[i] = sc.nextInt();
			num+=a[i];
		}
		int d = 0;
		for(int i=0;i<n-num;i++){
			if(a[i]==1) d ++;
		}
		long alle = n*(n-1)/2;
		long mot = mp.rev(alle);
		A = new long[n/2+1][n/2+1];
		for(int i=0;i<=n/2;i++){
			if(i!=0){
				A[i][i-1] = i * i * mot%mod;
			}
			if(i!=n/2){
				A[i][i+1] =Math.max(0,(n-num-i)) * Math.max(0,num-i) * mot % mod;
			}
			A[i][i] = Math.max(alle - i * i-Math.max(0,n-num-i) * Math.max(0,num-i),0)*mot%mod;
		}
		long[][] ans = pow(A,k);

		System.out.println(ans[d][0]);
	}
	private static long[][] pow(long[][] a2, long k) {
		if(k==1){
			return a2;
		}else{
			if(k%2==0){
				long[][] val = pow(a2,k/2);
				return mul(val,val);
			}else{
				return mul(pow(a2,k-1),A);
			}
		}
	}
	private static long[][] mul(long[][] a, long[][] b) {
		long[][] c = new long[n/2+1][n/2+1];
		for(int i=0;i<n/2+1;i++){
			for(int j=0;j<n/2+1;j++){
				for(int k=0;k<n/2+1;k++){
					c[i][j] += a[i][k] * b[k][j];
					c[i][j] %= mod;
				}
			}
		}
		return c;
	}

}

class SegmentTree<T,E>{
	int N;
	BiFunction<T,T,T> f;
	BiFunction<T,E,T> g;
	T d1;
	ArrayList<T> dat;
	SegmentTree(BiFunction<T,T,T> F,BiFunction<T,E,T> G,T D1,T[] v){
		int n = v.length;
		f = F;
		g = G;
		d1 = D1;
		init(n);
		build(v);
	}

	void init(int n) {
		N = 1;
		while(N<n)N*=2;
		dat = new ArrayList<T>();
	}

	void build(T[] v) {
		for(int i=0;i<2*N;i++) {
			dat.add(d1);
		}
		for(int i=0;i<v.length;i++) {
			dat.set(N+i-1,v[i]);
		}
		for(int i=N-2;i>=0;i--) {
			dat.set(i,f.apply(dat.get(i*2+1),dat.get(i*2+2)));
		}
	}

	void update(int k,E a) {
		k += N-1;
		dat.set(k,g.apply(dat.get(k),a));
		while(k>0){
			k = (k-1)/2;
			dat.set(k,f.apply(dat.get(k*2+1),dat.get(k*2+2)));
		}
	}

	T query(int a,int b, int k, int l ,int r) {
		if(r<=a||b<=l) return d1;
		if(a<=l&&r<=b) return dat.get(k);
		T vl = query(a,b,k*2+1,l,(l+r)/2);
		T vr = query(a,b,k*2+2,(l+r)/2,r);
		return f.apply(vl, vr);
	}
	T query(int a,int b){
		return query(a,b,0,0,N);
	}

}

class LazySegmentTree<T,E> extends SegmentTree<T,E>{
	BiFunction<E,E,E> h;
	BiFunction<E,Integer,E> p = (E a,Integer b) ->{return a;};
	E d0;
	ArrayList<E> laz;
	LazySegmentTree(BiFunction<T,T,T> F,BiFunction<T,E,T> G,BiFunction<E,E,E> H,T D1,E D0,T[] v){
		super(F,G,D1,v);
		int n = v.length;
		h = H;
		d0 = D0;
		Init(n);
	}
	void build() {

	}
	void Init(int n){
		laz = new ArrayList<E>();
		for(int i=0;i<2*N;i++) {
			laz.add(d0);
		}
	}

	void eval(int len,int k) {
		if(laz.get(k).equals(d0)) return;
		if(k*2+1<N*2-1) {
			laz.set(k*2+1,h.apply(laz.get(k*2+1),laz.get(k)));
			laz.set(k*2+2,h.apply(laz.get(k*2+2),laz.get(k)));
		}
		dat.set(k,g.apply(dat.get(k), p.apply(laz.get(k), len)));
		laz.set(k,d0);
	}

	T update(int a,int b,E x,int k,int l,int r) {
		eval(r-l,k);
		if(r<=a||b<=l) {
			return dat.get(k);
		}
		if(a<=l&&r<=b) {
			laz.set(k,h.apply(laz.get(k),x));
			return g.apply(dat.get(k),p.apply(laz.get(k),r-l));
		}
		T vl = update(a,b,x,k*2+1,l,(l+r)/2);
		T vr = update(a,b,x,k*2+2,(l+r)/2,r);
		dat.set(k,f.apply(vl,vr));
		return dat.get(k);

	}

	T update(int a,int b,E x) {
		return update(a,b,x,0,0,N);
	}

	T query(int a,int b,int k,int l,int r) {
		eval(r-l,k);
		if(r<=a||b<=l) return d1;
		if(a<=l&&r<=b) return dat.get(k);
		T vl = query(a,b,k*2+1,l,(l+r)/2);
		T vr = query(a,b,k*2+2,(l+r)/2,r);
		return f.apply(vl, vr);
	}

	T query(int a,int b){
		return query(a,b,0,0,N);
	}

}
class UnionFindTree {
	int[] root;
	int[] rank;
	int[] size;
	UnionFindTree(int N){
		root = new int[N];
		rank = new int[N];
		size = new int[N];
		for(int i=0;i<N;i++){
			root[i] = i;
			size[i] = 1;
		}
	}

	public int find(int x){
		if(root[x]==x){
			return x;
		}else{
			return find(root[x]);
		}
	}

	public void unite(int x,int y){
		x = find(x);
		y = find(y);
		if(x==y){
			return;
		}else{
			if(rank[x]<rank[y]){
				root[x] = y;
				size[y] += size[x];
			}else{
				root[y] = x;
				size[x] += size[y];
				if(rank[x]==rank[y]){
					rank[x]++;
				}
			}
		}
	}

	public boolean same(int x,int y){
		return find(x)==find(y);
	}

}

class ParticalEternalLastingUnionFindTree extends UnionFindTree{
	int[] time;
	int now;
	ParticalEternalLastingUnionFindTree(int N){
		super(N);
		time = new int[N];
		for(int i=0;i<N;i++) {
			time[i] = 1000000007;
		}
	}

	public int find(int t,int i) {
		if(time[i]>t) {
			return i;
		}else {
			return find(t,root[i]);
		}
	}

	public void unite(int x,int y,int t) {
		now = t;
		x = find(t,x);
		y = find(t,y);
		if(x==y)return;
		if(rank[x]<rank[y]){
			root[x] = y;
			size[y] += size[x];
			time[x] = t;
		}else{
			root[y] = x;
			size[x] += size[y];
			if(rank[x]==rank[y]){
				rank[x]++;
			}
			time[y] = t;
		}
	}

	public int sametime(int x,int y) {
		if(find(now,x)!=find(now,y)) return -1;
		int ok = now;
		int ng = 0;
		while(ok-ng>1) {
			int mid = (ok+ng)/2;
			if(find(mid,x)==find(mid,y)) {
				ok = mid;
			}else {
				ng = mid;
			}
		}
		return ok;
	}

}
class Graph {
	ArrayList<Edge>[] list;
	int size;

	TreeSet<LinkEdge> Edges = new TreeSet<LinkEdge>(new LinkEdgeComparator());

	@SuppressWarnings("unchecked")
	Graph(int N){
		size = N;
		list = new ArrayList[N];
		for(int i=0;i<N;i++){
			list[i] = new ArrayList<Edge>();
		}
	}

	void addEdge(int a,int b){
		list[a].add(new Edge(b,1));
	}

	void addWeightedEdge(int a,int b,long c){
		list[a].add(new Edge(b,c));
	}

	void addEgdes(int[] a,int[] b){
		int size = a.length;
		for(int i=0;i<size;i++){
			list[a[i]].add(new Edge(b[i],1));
		}
	}

	void addWeighterEdges(int[] a ,int[] b ,int[] c){
		int size = a.length;
		for(int i=0;i<size;i++){
			list[a[i]].add(new Edge(b[i],c[1]));
		}
	}

	long[] bfs(int s){
		long[] L = new long[size];
		for(int i=0;i<size;i++){
			L[i] = -1;
		}
		L[s] = 0;
		ArrayDeque<Integer> Q = new ArrayDeque<Integer>();
		Q.add(s);

		while(!Q.isEmpty()){
			int v = Q.poll();
			for(Edge e:list[v]){
				int w = e.to;
				long c = e.cost;
				if(L[w]==-1){
					L[w] = L[v] + c;
					Q.add(w);
				}
			}
		}

		return L;
	}

	long[] dijkstra(int s){
		long[] L = new long[size];
		for(int i=0;i<size;i++){
			L[i] = -1;
		}
		int[] visited = new int[size];
		L[s] = 0;
		PriorityQueue<Pair> Q = new PriorityQueue<Pair>(new SampleComparator());
		Q.add(new Pair(0,s));

		while(!Q.isEmpty()){

			Pair C = Q.poll();
			if(visited[(int)C.b]==0){
				L[(int)C.b] = C.a;
				visited[(int) C.b] = 1;
				for(Edge D:list[(int) C.b]){
					Q.add(new Pair(L[(int)C.b]+D.cost,D.to));
				}
			}
		}

		return L;
	}
	long[] maxtra(int s,long l){
		long[] L = new long[size];
		for(int i=0;i<size;i++){
			L[i] = -1;
		}
		int[] visited = new int[size];
		L[s] = -1;
	;
		PriorityQueue<Pair> Q = new PriorityQueue<Pair>(new SampleComparator());
		Q.add(new Pair(l,s));

		while(!Q.isEmpty()){

			Pair C = Q.poll();
			if(visited[(int)C.b]==0){
				L[(int)C.b] = C.a;
				visited[(int) C.b] = 1;
				for(Edge D:list[(int) C.b]){
					Q.add(new Pair(Math.max(L[(int)C.b],D.cost),D.to));
				}
			}
		}

		return L;
	}
	long Kruskal(){
		long ans = 0;
		for(int i=0;i<size;i++) {
			for(Edge e:list[i]) {
				Edges.add(new LinkEdge(e.cost,i,e.to));
			}
		}
		UnionFindTree UF = new UnionFindTree(size);
		for(LinkEdge e:Edges){
			if(e.a>=0&&e.b>=0) {
				if(!UF.same(e.a,e.b)){
					ans += e.L;
					UF.unite(e.a,e.b);
				}
			}
		}

		return ans;
	}

	ArrayList<Integer> Kahntsort(){

		ArrayList<Integer> ans = new ArrayList<Integer>();
		PriorityQueue<Integer> q = new PriorityQueue<Integer>();
		int[] in = new int[size];
		for(int i=0;i<size;i++) {
			for(Edge e:list[i]) {
				in[e.to]++;
			}
		}
		for(int i=0;i<size;i++) {
			if(in[i]==0) {
				q.add(i);
			}
		}
		while(!q.isEmpty()) {
			int v = q.poll();
			ans.add(v);
			for(Edge e:list[v]) {
				in[e.to]--;
				if(in[e.to]==0) {
					q.add(e.to);
				}
			}
		}
		for(int i=0;i<size;i++) {
			if(in[i]>0)return new ArrayList<Integer>();
		}
		return ans;
	}

	RootedTree dfsTree(int i) {
		int[] used = new int[size];
		RootedTree r = new RootedTree(size);
		dfsTree(i,used,r);
		return r;

	}

	private void dfsTree(int i, int[] used, RootedTree r) {
		used[i] = 1;
		for(Edge e:list[i]) {
			if(used[e.to]==0) {
				r.list[i].add(e);
				used[e.to] = 1;
				dfsTree(i,used,r);
			}
		}

	}
}

class Tree extends Graph{

	public Tree(int N) {
		super(N);
	}

	long[] tyokkei(){
		long[] a = bfs(0);

		System.out.println();
		int maxdex = -1;
		long max = 0;
		for(int i=0;i<size;i++){
			if(max<a[i]){
				max = a[i];
				maxdex = i;
			}
		}

		long[] b = bfs(maxdex);
		System.out.println();
		int maxdex2 = -1;
		long max2 = 0;
		for(int i=0;i<size;i++){
			if(max2<b[i]){
				max2 = b[i];
				maxdex2 = i;
			}
		}
		long[] ans = {max2,maxdex,maxdex2};
		return ans;
	}

}

class RootedTree extends Graph{

	RootedTree(int N){
		super(N);
	}

}
class LinkEdge{
	long L;
	int a ;
	int b;
	LinkEdge(long l,int A,int B){
		L = l;
		a = A;
		b = B;
	}
	public boolean equals(Object o){
		LinkEdge O = (LinkEdge) o;
		if(O.a==this.a&&O.b==this.b&&O.L==this.L){
			return true;
		}else{
			return false;
		}

	}

	public int hashCode(){
		return Objects.hash(L,a,b);
	}

}

class Edge{
	int to;
	long cost;

	Edge(int a,long b){
		to = a;
		cost = b;
	}

}
class LinkEdgeComparator implements Comparator<LinkEdge>{
	public int compare(LinkEdge P, LinkEdge Q) {
		long temp = P.L-Q.L;
		if(temp==0){
			if(P.a>Q.a){
				return 1;
			}else{
				if(P.b>Q.b){
					return 1;
				}else{
					return -1;
				}
			}

		}
		if(temp>=0){
			return 1;
		}else{
			return -1;
		}
	}

}
class Pair{
	long a;
	long b;

	Pair(long p,long q){
		this.a = p;
		this.b = q;
	}

	public boolean equals(Object o){
		Pair O = (Pair) o;
		if(O.a==this.a&&O.b==this.b){
			return true;
		}else{
			return false;
		}

	}

	public int hashCode(){
		return Objects.hash(a,b);
	}

}

class SampleComparator implements Comparator<Pair>{
	public int compare(Pair P, Pair Q) {
		long temp = P.a-Q.a;
		if(temp==0){
			if(P.b>Q.b){
				return 1;
			}else{
				return -1;
			}

		}
		if(temp>=0){
			return 1;
		}else{
			return -1;
		}
	}

}

class LongIntPair{
	long a;
	int b;

	LongIntPair(long p,int q){
		this.a = p;
		this.b = q;
	}

	public boolean equals(Object o){
		Pair O = (Pair) o;
		if(O.a==this.a&&O.b==this.b){
			return true;
		}else{
			return false;
		}

	}

	public int hashCode(){
		return Objects.hash(a,b);
	}

}

class LongIntSampleComparator implements Comparator<LongIntPair>{
	public int compare(LongIntPair P, LongIntPair Q) {
		long temp = P.a-Q.a;
		if(temp==0){
			if(P.b>Q.b){
				return 1;
			}else{
				return -1;
			}

		}
		if(temp>=0){
			return 1;
		}else{
			return -1;
		}
	}

}

class FastScanner {
    private final java.io.InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
    public boolean hasNext() { skipUnprintable(); return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return (minus ? -n : n);
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return (int) (minus ? -n : n);
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
}

class Mathplus{
	int mod = 1000000007;
	long[] fac = new long[1000001];
	long[][] combt = new long[2001][2001];
	long[][] permt = new long[2001][2001];
	boolean isBuild = false;
	boolean isBuildc = false;
	boolean isBuildp = false;
	int mindex = -1;
	int maxdex = -1;

	void buildFac(){
		fac[0] = 1;
		for(int i=1;i<=1000000;i++){
			fac[i] = (fac[i-1] * i)%mod;
		}
		isBuild = true;
	}

	void buildComb() {
		for(int i=0;i<=2000;i++) {
			combt[i][0] = 1;
		}
		for(int j=1;j<=2000;j++) {
			combt[j][j] = 1;
			for(int i=j+1;i<=2000;i++) {
				combt[i][j] = combt[i-1][j-1] + combt[i-1][j];
				if(combt[i][j]>=mod)combt[i][j]-=mod;
			}

		}
		isBuildc = false;
	}

	void buildPerm() {
		for(int i=0;i<=2000;i++) {
			permt[i][0] = 1;
		}
		if(!isBuild)buildFac();
		for(int i=1;i<=2000;i++) {
			for(int j=1;j<=i;j++) {
				permt[i][j] = permt[i][j-1]*(i-j+1);
				permt[i][j] %= mod;
			}
		}
		isBuildp = true;
	}

	public int isBigger(int[] d, int i) {
		int ok = d.length;
		int ng = -1;
		while(Math.abs(ok-ng)>1) {
			int mid = (ok+ng)/2;
			if(d[mid]>i) {
				ok = mid;
			}else {
				ng = mid;
			}
		}
		return ok;
	}

	public int isSmaller(int[] d, int i) {
		int ok = -1;
		int ng = d.length;
		while(Math.abs(ok-ng)>1) {
			int mid = (ok+ng)/2;
			if(d[mid]<i) {
				ok = mid;
			}else {
				ng = mid;
			}
		}
		return ok;
	}

	public HashSet<Integer> primetable(int m) {
		HashSet<Integer> pt = new HashSet<Integer>();
		for(int i=2;i<=m;i++) {
			boolean b = true;
			for(int d:pt) {
				if(i%d==0) {
					b = false;
					break;
				}
			}
			if(b) {
				pt.add(i);
			}
		}
		return pt;
	}

	long max(long[] a){
		long max = 0;
		for(int i=0;i<a.length;i++){
			if(max<a[i]){
				max =a[i];
				maxdex = i;
			}
		}
		return max;
	}
	int max(int[] a){
		int max = 0;
		for(int i=0;i<a.length;i++){
			if(max<a[i]){
				max =a[i];
				maxdex = i;
			}
		}
		return max;
	}
	long min(long[] a){
		long min = Long.MAX_VALUE;
		for(int i=0;i<a.length;i++){
			if(min>a[i]){
				min =a[i];
				mindex = i;
			}
		}
		return min;
	}
	int min(int[] a){
		int min = Integer.MAX_VALUE;
		for(int i=0;i<a.length;i++){
			if(min>a[i]){
				min =a[i];
				mindex = i;
			}
		}
		return min;
	}
	long sum(long[] a){
		long sum = 0;
		for(int i=0;i<a.length;i++){
			sum += a[i];
		}
		return sum;
	}
	long sum(int[] a){
		long sum = 0;
		for(int i=0;i<a.length;i++){
			sum += a[i];
		}
		return sum;
	}

	long gcd(long a, long b){
		if(a<b){
			a^=b;
			b^=a;
			a^=b;
		}
		if(a%b==0){
			return b;
		}else{
			return gcd(b,a%b);
		}
	}

	long lcm(long a, long b){
		return a / gcd(a,b) * b;
	}

	public long perm(int a,int num) {
		if(a<2000&&num<2000) {
			if(!isBuildp) {
				buildPerm();
				isBuildp = true;
 			}
			return permt[a][num];
		}
		if(!isBuild) {
			buildFac();
		}
		return fac[a] * (rev(fac[a-num]))%mod;
	}
	public long comb(int a,int num){
		if(a<2000&&num<2000) {
			if(!isBuildc) {
				buildComb();
				isBuildc = true;
 			}
			return combt[a][num];
		}
		if(!isBuild){
			buildFac();
		}
		return fac[a] * (rev(fac[num])*rev(fac[a-num])%mod)%mod;
	}

	long rev(long l) {
		return pow(l,mod-2);
	}

	long pow(long l, int i) {
		if(i==0){
			return 1;
		}else{
			if(i%2==0){
				long val = pow(l,i/2);
				return val * val % mod;
			}else{
				return pow(l,i-1) * l % mod;
			}
		}
	}

}

//package Contest553;

import java.io.PrintWriter;
import java.util.Scanner;

public class mainF {
    public static Scanner enter = new Scanner(System.in);
    public static PrintWriter out = new PrintWriter(System.out);
    public static void main(String[] args) {
        long mod=(long)1e9+7;
        int n=enter.nextInt();
        long s=enter.nextLong();
        int[] arr=new int[n];
        int m=0;
        long CON=n*(n-1)/2;
        CON=bin_pow(CON,mod-2,mod);
        for (int i = 0; i <n ; i++) {
            arr[i]=enter.nextInt();
            m+=arr[i];
        }
        if(m<n-m){
            for (int i = 0; i <n ; i++) {
                arr[i]++;
                arr[i]%=2;
            }
            m=n-m;
        }
        int f_k=0;
        for (int i = 0; i <n-m ; i++) {
            f_k+=arr[i];
        }
        //f_k- кол-во нулей в первой части то есть это начальное состояние причём кол-во нулей меньше кол-ва единиц
        int k=n-m;
        f_k=n-m-f_k;
        /*System.out.println(f_k);
        System.out.println(k);
        System.out.println(m);*/
        long[][] CM=new long[k+1][k+1];
        for (int i = 0; i <CM.length ; i++) {
            CM[i][i]=(1-(long)(i*(m-k+i)+(k-i)*(k-i))*CON);
            if(i<k) CM[i][i+1]=(long)(k-i)*(k-i)*CON;
            if(i>0)CM[i][i-1]=(long)i*(m-k+i)*CON;
        }
        MATRIX_mod(CM,mod);
        CM=bin_pow(CM,s,mod);
        System.out.println((CM[f_k][k]+mod)%mod);

    }
    public static long bin_pow(long a,long b, long mod){//a^b %mod
        long ans=1;
        while(b!=0){
            if((b&1)==1) ans*=a;
            a*=a;
            ans%=mod;
            a%=mod;
            b>>=1;
        }
        return ans;
    }

    public static long[][] bin_pow(long[][] a,long b, long mod){//a^b %mod
        long[][] ans=new long[a.length][a.length];
        for (int i = 0; i <ans.length ; i++) ans[i][i]=1;
        while(b!=0){
            if((b&1)==1) ans=MATRIX_mult(ans,a);
            a=MATRIX_mult(a,a);
            MATRIX_mod(ans,mod);
            MATRIX_mod(a,mod);
            b>>=1;
        }
        return ans;
    }
    public static long[][] MATRIX_mult(long[][] a, long[][] b) { //b не меняем a=a*b;
        long[][] c=new long[a.length][a.length];
        for (int i = 0; i <a.length ; i++) {
            for (int j = 0; j <a.length ; j++) {
                for (int k = 0; k <a.length ; k++) {
                    c[i][j]+=a[i][k]*b[k][j];
                    c[i][j]%=(long)(1e9+7);
                }
            }
        }
        return c;
    }
    public static void MATRIX_mod(long[][] a, long mod){
        for (int i = 0; i <a.length ; i++) {
            for (int j = 0; j <a.length ; j++) {
                a[i][j]%=mod;
            }
        }
    }
}

//package Contest553;

import java.io.PrintWriter;
import java.util.Scanner;

public class mainF {
    public static Scanner enter = new Scanner(System.in);
    public static PrintWriter out = new PrintWriter(System.out);
    public static void main(String[] args) {
        long mod=(long)1e9+7;
        int n=enter.nextInt();
        long s=enter.nextLong();
        int[] arr=new int[n];
        int m=0;
        long CON=n*(n-1)/2;
        CON=bin_pow(CON,mod-2,mod);
        for (int i = 0; i <n ; i++) {
            arr[i]=enter.nextInt();
            m+=arr[i];
        }
        System.out.println(m);
        System.out.println(n);
       /* if(m<n-m){
            for (int i = 0; i <n ; i++) {
                arr[i]++;
                arr[i]%=2;
            }
            m=n-m;
        }*/
        int f_k=0;
        for (int i = 0; i <n-m ; i++) {
            f_k+=arr[i];
        }
        //f_k- кол-во нулей в первой части то есть это начальное состояние причём кол-во нулей меньше кол-ва единиц
        int k=n-m;
        f_k=n-m-f_k;
        System.out.println(f_k);
        System.out.println(k);
        System.out.println(m);
        long[][] CM=new long[k+1][k+1];
        for (int i = 0; i <CM.length ; i++) {
            CM[i][i]=(1-(long)(i*(m-k+i)+(k-i)*(k-i))*CON);
            if(i<k) CM[i][i+1]=(long)(k-i)*(k-i)*CON;
            if(i>0)CM[i][i-1]=(long)i*(m-k+i)*CON;
        }
        MATRIX_mod(CM,mod);
        CM=bin_pow(CM,s,mod);
        System.out.println((CM[f_k][k]+mod)%mod);

    }
    public static long bin_pow(long a,long b, long mod){//a^b %mod
        long ans=1;
        while(b!=0){
            if((b&1)==1) ans*=a;
            a*=a;
            ans%=mod;
            a%=mod;
            b>>=1;
        }
        return ans;
    }

    public static long[][] bin_pow(long[][] a,long b, long mod){//a^b %mod
        long[][] ans=new long[a.length][a.length];
        for (int i = 0; i <ans.length ; i++) ans[i][i]=1;
        while(b!=0){
            if((b&1)==1) ans=MATRIX_mult(ans,a);
            a=MATRIX_mult(a,a);
            MATRIX_mod(ans,mod);
            MATRIX_mod(a,mod);
            b>>=1;
        }
        return ans;
    }
    public static long[][] MATRIX_mult(long[][] a, long[][] b) { //b не меняем a=a*b;
        long[][] c=new long[a.length][a.length];
        for (int i = 0; i <a.length ; i++) {
            for (int j = 0; j <a.length ; j++) {
                for (int k = 0; k <a.length ; k++) {
                    c[i][j]+=a[i][k]*b[k][j];
                    c[i][j]%=(long)(1e9+7);
                }
            }
        }
        return c;
    }
    public static void MATRIX_mod(long[][] a, long mod){
        for (int i = 0; i <a.length ; i++) {
            for (int j = 0; j <a.length ; j++) {
                a[i][j]%=mod;
            }
        }
    }
}

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static long MOD = 1000000007;

    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();
        final int k = scanner.nextInt();

        final ArrayList<Integer> values = new ArrayList<>(n);
        for (int i = 0; i < n; i++) {
            values.add(scanner.nextInt());
        }

        final int zeroCount = values.stream().filter(integer -> integer.equals(0)).mapToInt(i -> 1).sum();
        final int oneCount = n - zeroCount;
        final int size = Math.min(zeroCount, oneCount);

        long[][] table = new long[size + 1][size + 1];

        int diff = 0;
        for (int i = 0; i < n; i++) {
            if (values.get(i) == 0 && i >= zeroCount) {
                diff++;
            }
        }

        final int allPosible = (n * (n - 1)) / 2;
        final long allPosibleInverse = binPow(allPosible, MOD - 2);
        for (int i = 0; i < size + 1; i++) {
            for (int j = 0; j < size + 1; j++) {

                if (i - j == 1) {
                    table[i][j] = i * i * allPosibleInverse;
                }

                if (i - j == 0) {
                    table[i][j] = (allPosible - i * i - (zeroCount - i) * (oneCount - i)) * allPosibleInverse;
                }

                if (i - j == -1) {
                    table[i][j] = (zeroCount - i) * (oneCount - i) * allPosibleInverse;
                }
            }
        }

        table = binPow(table, k);

//        for (long[] longs : table) {
//            for (long value : longs) {
//                System.out.printf("%10d", value);
//            }
//            System.out.println();
//        }

        System.out.println(table[diff][0]);
    }

    private static long binPow(long n, long count) {
        if (count == 0) {
            return 1L;
        }

        long temp = binPow(n, count / 2);
        temp = (temp * temp) % MOD;
        if (count % 2 != 0) {
            temp = (temp * n) % MOD;
        }

        return temp % MOD;
    }

    private static long[][] binPow(long[][] table, long count) {
        if (count == 0) {
            final long[][] ans = new long[table.length][table.length];
            for (int i = 0; i < table.length; i++) {
                ans[i][i] = 1;
            }
            return ans;
        }

        long[][] temp = binPow(table, count / 2);
        temp = (mul(temp, temp));
        if (count % 2 != 0) {
            temp = mul(temp, table);
        }

        return temp;
    }

    private static long[][] mul(long[][] a, long[][] b) {
        final long[][] ans = new long[a.length][a.length];
        for (int i = 0; i < a.length; i++) {
            for (int j = 0; j < a.length; j++) {
                for (int k = 0; k < a.length; k++) {
                    ans[i][j] += (a[i][k] * b[k][j]) % MOD;
                    ans[i][j] = ans[i][j] % MOD;
                }
            }
        }
        return ans;
    }
}