#include #include using namespace std; using ll = long long; #define rep(i,n) for(int i=0;i<(int)(n);i++) using mint = atcoder::modint; int main(){ int n,b; cin>>n>>b; vector a(n); rep(i,n) cin>>a.at(i); mint::set_mod(b); mint ans=0; map mp; rep(i,n){ mp[a.at(i)]++; mint tmp=mint(2).pow(n-mp.size()); cout<<(ans+tmp).val()<<"\n"; if(mp.at(a.at(i))<=1) ans+=tmp; } }