#include using namespace std; typedef long long int ll; static const int MAX_N = 200000; int N, M; int a[MAX_N]; string S; int b[MAX_N]; class RAQ{ public: int n; vector dat, dat2; RAQ(){} RAQ(int size){ n = 1; while(n < size) n *= 2; dat.resize(2 * n - 1, 0); dat2.resize(2 * n - 1, 0); } void add(int l, int r, ll x){ rangeAdd(l, r + 1, x, 0, 0, n); } void rangeAdd(int a, int b, ll x, int k, int l, int r){ if(a <= l && r <= b){ dat[k] += x; }else if(l < b && a < r){ dat2[k] += (min(b, r) - max(a, l)) * x; rangeAdd(a, b, x, 2 * k + 1, l, (l + r) / 2); rangeAdd(a, b, x, 2 * k + 2, (l + r) / 2, r); } } ll getSum(int s, int t){ return query(s, t + 1, 0, 0, n); } ll query(int a, int b, int k, int l, int r){ if(r <= a || b <= l) return 0; if(a <= l && r <= b) return dat[k] * (r - l) + dat2[k]; else{ ll ret = (min(b, r) - max(a, l)) * dat[k]; ll vl = query(a, b, 2 * k + 1, l, (l + r) / 2); ll vr = query(a, b, 2 * k + 2, (l + r) / 2, r); return ret + vl + vr; } } }; int main(){ scanf("%d %d", &N, &M); for(int i = 0; i < N; i++) scanf("%d", &a[i]); cin >> S; RAQ rq(N); for(int i = 0; i < N; i++) rq.add(i, i, i); for(int i = 0; i < M; i++){ if(S[i] == 'L'){ int lb = -1, ub = N - 1; while(ub - lb > 1){ int mid = lb + (ub - lb) / 2; if(rq.getSum(mid, mid) >= 1) ub = mid; else lb = mid; } if(rq.getSum(N - 1, N - 1) != 0) rq.add(ub, N - 1, -1); }else{ int lb = 0, ub = N; while(ub - lb > 1){ int mid = lb + (ub - lb) / 2; if(rq.getSum(mid, mid) <= N - 2) lb = mid; else ub = mid; } if(rq.getSum(0, 0) != N - 1) rq.add(0, lb, 1); } } for(int i = 0; i < N; i++){ int pos = rq.getSum(i, i); b[pos] += a[i]; } for(int i = 0; i < N; i++) printf("%d%c", b[i], (i == N - 1 ? '\n' : ' ')); return 0; }