{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"Farmer Johnson\u0027s Bulls love playing basketball very much. But none of them would like to play basketball with the other bulls because they believe that the others are all very weak. Farmer Johnson has N cows (we number the cows from 1 to N) and M barns (we number the barns from 1 to M), which is his bulls\u0027 basketball fields. However, his bulls are all very captious, they only like to play in some specific barns, and don’t want to share a barn with the others.\r\u003cbr\u003e\r\u003cbr\u003eSo it is difficult for Farmer Johnson to arrange his bulls, he wants you to help him. Of course, find one solution is easy, but your task is to find how many solutions there are.\r\u003cbr\u003e\r\u003cbr\u003eYou should know that a solution is a situation that every bull can play basketball in a barn he likes and no two bulls share a barn.\r\u003cbr\u003e\r\u003cbr\u003eTo make the problem a little easy, it is assumed that the number of solutions will not exceed 10000000."}},{"title":"Input","value":{"format":"HTML","content":"In the first line of input contains two integers N and M (1 \u0026lt;\u003d N \u0026lt;\u003d 20, 1 \u0026lt;\u003d M \u0026lt;\u003d 20). Then come N lines. The i-th line first contains an integer P (1 \u0026lt;\u003d P \u0026lt;\u003d M) referring to the number of barns cow i likes to play in. Then follow P integers, which give the number of there P barns."}},{"title":"Output","value":{"format":"HTML","content":"Print a single integer in a line, which is the number of solutions."}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e3 4\r\n2 1 4\r\n2 1 3\r\n2 2 4\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e4\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}