#include #include using namespace std; int main(){ int N,M; cin >> N >> M; vector a(N); for(int i=0;i> a[i]; int lp=0,rp=N-1,lt=0,rt=N-1; string cmd; cin >> cmd; for(int p=0;prp)lp=rp; }else{ lp--;rp--; if(lp==-1){ lp++; lt++; if(rt==-1)rt++; if(lt>rt)lt=rt; } if(rp0)cout << " "; if(p