#include<bits/stdc++.h>
#define FOR(i,a,b,k) for (ll i=a;i<=b;i+=k)
#define FORD(i,a,b,k) for (ll i=a;i>=b;i-=k)
#define pb(i) push_back(i)
#define ll long long int
#define MOD 1000000007
#define lim 1e16
using namespace std;
ll q,a;
ll head=0,m[100001]={0};
string s;
void dao(ll i, ll j)
{
ll l=s.length();
FOR(chiso,i,j,1) swap(s[chiso-1],s[l-chiso]);
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);
cin>>s>>q;
ll l=s.length();
FOR(i,1,q,1)
{
cin>>a;
if(a>l/2) a=l-a+1;
head=max(head,a);
m[a]++;
}
if(q%2==1) dao(head,l/2);
q-=m[head];
head--;
FORD(i,head,1,1)
{
if(m[i]!=0)
{
if(q%2==1) dao(i,head);
q-=m[i];
head=i-1;
cout<<i<<" ";
}
}
cout<<s;
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KI2RlZmluZSBGT1IoaSxhLGIsaykgZm9yIChsbCBpPWE7aTw9YjtpKz1rKQojZGVmaW5lIEZPUkQoaSxhLGIsaykgZm9yIChsbCBpPWE7aT49YjtpLT1rKQojZGVmaW5lIHBiKGkpIHB1c2hfYmFjayhpKQojZGVmaW5lIGxsIGxvbmcgbG9uZyBpbnQKI2RlZmluZSBNT0QgMTAwMDAwMDAwNwojZGVmaW5lIGxpbSAxZTE2CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CmxsIHEsYTsKbGwgaGVhZD0wLG1bMTAwMDAxXT17MH07CnN0cmluZyBzOwoKdm9pZCBkYW8obGwgaSwgbGwgaikKewoJbGwgbD1zLmxlbmd0aCgpOwoJCglGT1IoY2hpc28saSxqLDEpIHN3YXAoc1tjaGlzby0xXSxzW2wtY2hpc29dKTsKfQoKaW50IG1haW4oKQp7CiAgICAJaW9zX2Jhc2U6OnN5bmNfd2l0aF9zdGRpbyhmYWxzZSk7CiAgICAgICAgY2luLnRpZShOVUxMKTtjb3V0LnRpZShOVUxM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