using System; using System.Linq; using System.Collections.Generic; using System.Text; public class Program { public void Proc() { Reader.IsDebug = false; int[] inpt = Reader.ReadLine().Split(' ').Select(a=>int.Parse(a)).ToArray(); this.Length = inpt[0]; if(inpt[1] == 0) { this.NumList = new long[] {0, ((long)1<long.Parse(a))).OrderBy(a=>a).ToArray(); } long ans = 1; for(int i=1; ia=='1')-prev.Count(a=>a=='1'); for(int j=1; j<=cnt; j++) { ans *= j; ans = ans % MOD; } } Console.WriteLine(ans); } private const long MOD = 1000000000 + 7; private int Length = 0; private long[] NumList; public class Reader { public static bool IsDebug = true; private static System.IO.StringReader SReader; private static string InitText = @" 60 61 0 576460752303423488 864691128455135232 1008806316530991104 1080863910568919040 1116892707587883008 1134907106097364992 1143914305352105984 1148417904979476480 1150669704793161728 1151795604700004352 1152358554653425664 1152640029630136320 1152780767118491648 1152851135862669312 1152886320234758144 1152903912420802560 1152912708513824768 1152917106560335872 1152919305583591424 1152920405095219200 1152920954851033088 1152921229728940032 1152921367167893504 1152921435887370240 1152921470247108608 1152921487426977792 1152921496016912384 1152921500311879680 1152921502459363328 1152921503533105152 1152921504069976064 1152921504338411520 1152921504472629248 1152921504539738112 1152921504573292544 1152921504590069760 1152921504598458368 1152921504602652672 1152921504604749824 1152921504605798400 1152921504606322688 1152921504606584832 1152921504606715904 1152921504606781440 1152921504606814208 1152921504606830592 1152921504606838784 1152921504606842880 1152921504606844928 1152921504606845952 1152921504606846464 1152921504606846720 1152921504606846848 1152921504606846912 1152921504606846944 1152921504606846960 1152921504606846968 1152921504606846972 1152921504606846974 1152921504606846975 "; public static string ReadLine() { if(IsDebug) { if(SReader == null) { SReader = new System.IO.StringReader(InitText.Trim()); } return SReader.ReadLine(); } else { return Console.ReadLine(); } } } public static void Main(string[] args) { Program prg = new Program(); prg.Proc(); } }