#include #include #include #include #include #include #include #include #include #include #include using namespace std; #define MOD 1000000007 #define MOD2 998244353 #define INF ((1<<30)-1) #define LINF (1LL<<60) #define EPS (1e-10) typedef long long Int; typedef pair P; int n, m; string s; int a[220000]; int main(){ cin >> n >> m; for(int i = 0;i < n;i++)cin >> a[i]; int l = 0, r = n-1; cin >> s; for(char c:s){ if(c == 'R'){ if(r == 0)continue; a[r-1] += a[r]; a[r] = 0; l--,r--; } else{ if(l == n-1)continue; a[l+1] += a[l]; a[l] = 0; l++,r++; } } for(int i = l;i <= r;i++){ if(0 <= i && i < n)cout << a[i] << " "; else cout << 0 << " "; }cout << endl; return 0; }