#include using namespace std; typedef pair P; typedef long long ll; typedef long double ld; const int inf=1e9+7; const ll longinf=1LL<<60; #define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i ) #define rep(i,n) REP(i,0,n) #define F first #define S second const int mx=100010; const ll mod=1e9+7; int main(){ int n,m; string s; cin >> n >> m; vector a(n); rep(i,n) cin>>a[i]; cin >> s; int pos = 0; rep(i,m){ if(s[i]=='L'){ pos--; } else { pos++; } if(pos<0 && abs(pos)0 && abs(pos)=pos){ cout << a[n-1] << " "; rep(i,n-1) cout << 0 << " "; cout << endl; return 0; } if(pos>0){ rep(i,pos) cout << 0 << " "; for(int i=0; i