{"trustable":false,"sections":[{"title":"题目描述","value":{"format":"MD","content":"\u003cstyle type\u003d\"text/css\"\u003e h1,h2,h3,h4,h5,h6 { margin-bottom:0; } div.textBG p { margin: 0 0 0.0001pt; }\u003c/style\u003e\u003cspan style\u003d\u0027float:right\u0027\u003e \u003ca target\u003d\u0027_blank\u0027 href\u003d\u0027CDN_BASE_URL/1e09151fb71ddb284aaf97fbeace21eb?v\u003d1699509615\u0027\u003e \u003cimg width\u003d\u0027100\u0027 height\u003d\u002726\u0027 border\u003d\u00270\u0027 title\u003d\u0027Download as PDF\u0027 alt\u003d\u0027Download as PDF\u0027 src\u003d\u0027CDN_BASE_URL/6d679b24335f6891d328af320270f504?v\u003d1699509615\u0027\u003e \u003c/a\u003e\u003c/span\u003e\u003cdiv style\u003d\u0027clear:both\u0027\u003e\u003c/div\u003e\u003ciframe src\u003d\"CDN_BASE_URL/1e09151fb71ddb284aaf97fbeace21eb?v\u003d1699509615#view\u003dFitH\" style\u003d\"width:100%; height:1400px;\" frameborder\u003d\"0\"\u003e\u003c/iframe\u003e\n\n对于给定的n个数,a1,a2,……,an,依次求出相邻两数之和,将得到一个新数列。\n\n重复上述操作,最后结果变成一个数。问这个数除以m的余数与哪些数无关?\n\n例如n\u003d3,m\u003d2时,第一次求和得到a1+a2,a2+a3,再求和得到a1+2a2+a3,它除以2的余数和a2无关。\n\n(1 ≤ n ≤ 1e5, 2 ≤ m ≤ 1e9 )"}},{"title":"INPUT","value":{"format":"MD","content":"多组数据\n每组数据在一行上输入两个整数 $n, m (1 \\le n \\le 10^5, 2 \\le m \\le 10^9)$"}},{"title":"OUTPUT","value":{"format":"MD","content":"每组数据输出两行,第一行是无关元素的个数,第二行按照递增序输出无关元素的编号。\n"}},{"title":"输入样例","value":{"format":"MD","content":"```\n3 2\n```"}},{"title":"输出样例","value":{"format":"MD","content":"```\n1\n2\n```\n"}}]}