import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] sa = br.readLine().split(" "); int n = Integer.parseInt(sa[0]); int m = Integer.parseInt(sa[1]); sa = br.readLine().split(" "); int[] a = new int[600005]; for (int i = 0; i < n; i++) { a[200001 + i] = Integer.parseInt(sa[i]); } char[] s = br.readLine().toCharArray(); br.close(); int l = 200001; int r = 200001 + n - 1; for (int i = 0; i < m; i++) { if (s[i] == 'L') { a[l + 1] += a[l]; a[l] = 0; l++; r++; } else { a[r - 1] += a[r]; a[r] = 0; r--; l--; } } StringBuilder sb = new StringBuilder(); for (int i = l; i < l + n; i++) { sb.append(a[i]).append(' '); } sb.deleteCharAt(sb.length() - 1); System.out.println(sb.toString()); } }