#include <bits/stdc++.h>
using namespace std;
int main(void){
    string s;
    int w;
    cin>>s>>w;
    for (int i=0;i+w<=s.size();i+=w) {
        cout<<s[i];
    }
    if (s.size()%w!=0) {
        reverse(s.begin(),s.end());
        string tmp=s.substr(0,s.size()%w);
        cout<<tmp[tmp.size()-1];
    }
    cout<<endl;
}
#include <bits/stdc++.h>
using namespace std;
int main()
{
	string str;
	int n;
	cin>>str>>n;
	string adj;
	int at = 0;
	while(at < str.size())
	{
		adj.push_back(str[at]);
		at+=n;
	}
	cout<<adj<<endl;
	return 0;
}