#include #include #define rep(i,n) for(int i=0;i vi; typedef vector vl; typedef vector> vvi; typedef vector> vvl; typedef long double ld; typedef pair P; ostream& operator<<(ostream& os, const modint& a) {os << a.val(); return os;} template ostream& operator<<(ostream& os, const static_modint& a) {os << a.val(); return os;} template istream& operator>>(istream& is, vector& v){int n = v.size(); assert(n > 0); rep(i, n) is >> v[i]; return is;} template ostream& operator<<(ostream& os, const pair& p){os << p.first << ' ' << p.second << "\n"; return os;} template ostream& operator<<(ostream& os, const vector& v){int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "\n" : " "); return os;} template ostream& operator<<(ostream& os, const vector>& v){int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "\n" : ""); return os;} using mint = modint; const int M = 100005; int main(){ int n, b; cin >> n >> b; vi a(n); cin >> a; rep(i, n) a[i]--; mint::set_mod(b); vector bi(M); bi[0] = 1; rep(i, M - 1) bi[i + 1] = bi[i] * 2; set se; rep(i, n){ mint ans; int k = int(se.size()) + 1; if(se.find(a[i]) == se.end()) ans = (bi[k] - 1) * bi[n - k]; else ans = bi[n]; cout << ans << "\n"; se.insert(a[i]); } return 0; }