import java.util.*; public class Main { static final int MOD = 1000000007; public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); ArrayDeque deq = new ArrayDeque<>(); for (int i = 0; i < n; i++) { deq.add(sc.nextInt()); } char[] arr = sc.next().toCharArray(); for (char c : arr) { if (c == 'L') { deq.addFirst(deq.pollFirst() + deq.pollFirst()); deq.addLast(0); } else { deq.addLast(deq.pollLast() + deq.pollLast()); deq.addFirst(0); } } boolean isFirst = true; StringBuilder sb = new StringBuilder(); for (int x : deq) { if (isFirst) { isFirst = false; } else { sb.append(" "); } sb.append(x); } System.out.println(sb); } }