#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
#pragma G++ optimize(3)
void flip(string& s)
{
reverse(s.begin(), s.end());
}
void bitNot(string& s)
{
for (char& c : s)
{
c = c == '0' ? '1' : '0';
}
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n, s;
string t, y;
cin >> n >> s;
cin.ignore();
cin >> t;
cin >> y;
for (char op : y)
{
if (op == '1')
{
flip(t);
}
else if (op == '2')
{
bitNot(t);
}
}
cout << t << endl;
return 0;
}