import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class Solution { static CombNumbers combNumb = new CombNumbers(); static int mod = 1_000_000_007; public static void main(String[] args) throws FileNotFoundException { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int q = sc.nextInt(); String s = sc.next(); int[] chars = new int[s.length()]; for(int i=0; itop) bottom = top-bottom; return factorials[top] * inverse(factorials[bottom]*factorials[top-bottom]%mod, mod) % mod; } /** * Use to calculate single combinatorial number or when when top>10^7. */ // public long combNumber(long top, long bottom, int mod) { // if(2*bottom>top) bottom = top-bottom; // // long topProd = 1; // long bottomProd = 1; // for(int i=1; i<=bottom; i++){ // topProd = (topProd * (top+1-i)) % mod; // bottomProd = (bottomProd * i) % mod; // } // return topProd * inverse(bottomProd, mod) % mod; // } private static long inverse(long number, int prime){ return power(number, prime-2, prime); } private static long power(long base, long exp, int mod){ if(exp==0) return 1; long result = 1; while(exp > 0){ if(exp%2==0) { base = (base*base)%mod; exp /= 2; } else { exp--; result = (result*base)%mod; } } return result; } public static long[] factorials(int max, int mod){ long[] fact = new long[max+1]; fact[0] = 1; for(int i=1; i<=max; i++) fact[i] = (fact[i-1]*i) %mod; return fact; } }