import java.util.Scanner;
import java.io.File;
import java.io.PrintWriter;

/**
 * Created by IntelliJ IDEA.
 * User: m09fav
 * Date: 28.10.2009
 * Time: 17:56:50
 * To change this template use File | Settings | File Templates.
 */
public class deck {
    public static void main (String[]args) throws Exception {
        Scanner in = new Scanner(new File ("deck.in"));
        PrintWriter out = new PrintWriter ("deck.out");
        String s1 = in.next();
        int [] com = new int [s1.length()];
        for (int k=0;in.hasNext();k++) {
            com[k]=in.nextInt();
        }
        char [] c1 = s1.toCharArray();
        char [] c2 = new char [s1.length()];
        for (int i=0;i<(s1.length());i++) {
            for (int l = i - 1; l >= com[i]; l--) {
                c2[l + 1] = c2[l];
            }
            c2[ com[i] ]=c1[i];
        }
        for (int j=0;j<(s1.length());j++)  {
        out.print(c2[j]);
        }
        in.close();
        out.close();

}
}
