/**
 * Created by IntelliJ IDEA.
 * User: o_220
 * Date: 28.10.2009
 * Time: 18:20:12
 * To change this template use File | Settings | File Templates.
 */ import java.util.*;
    import java.io.*;
public class Main {
    public static void main(String[] args) throws Exception{
        Scanner s= new Scanner(new File("desk.in"));
        PrintWriter p= new PrintWriter (new File("desk.out"));
        char [] c1 = s.next().toCharArray();
        char [] c2 = new char[c1.length];
        c2[0] = c1[0];
        s.nextInt();
        for (int i=1; i < c1.length; i++) {
            int ss = s.nextInt();
            for (int j=i-1; j >= ss; j--) {
                c2[j+1]=c2[j];
            }
            c2[ss] = c1[i];
        }
        for (int i=0; i < c1.length; i++) {
            p.print(c2[i]);
        }
        p.println();
        s.close();
        p.close();
    }
}
