#include <iostream>
#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <string>
#include <map>
#include <cstring>
#include <vector>
#define MAX 100005
using namespace std;
int main()
{
string s;
cin >> s;
int k;
cin >> k;
int l = s.size();
bool flag = false;
if(l % k == 1 || k > l)
cout << "NO";
else{
int step = k, d = l / k;
int pos = 0;
for(int i = 1; i <= step; i++){
for(int j = pos, v = d + pos - 1; j < d + pos - 1; j++, v--){
if(s[j] != s[v]){
cout << "NO";
return 0;
}
}
pos += d;
}
cout << "YES";
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y3N0ZGlvPgojaW5jbHVkZSA8YWxnb3JpdGhtPgojaW5jbHVkZSA8c3RhY2s+CiNpbmNsdWRlIDxxdWV1ZT4KI2luY2x1ZGUgPHN0cmluZz4KI2luY2x1ZGUgPG1hcD4KI2luY2x1ZGUgPGNzdHJpbmc+CiNpbmNsdWRlIDx2ZWN0b3I+CiNkZWZpbmUgTUFYIDEwMDAwNQp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKQp7CiAgICBzdHJpbmcgczsKICAgIGNpbiA+PiBzOwogICAgaW50IGs7CiAgICBjaW4gPj4gazsKICAgIGludCBsID0gcy5zaXplKCk7CiAgICBib29sIGZsYWcgPSBmYWxzZTsKICAgIGlmKGwgJSBrID09IDEgfHwgayA+IGwpCiAgICAgICAgY291dCA8PCAiTk8iOwogICAgZWxzZXsKICAgICAgICBpbnQgc3RlcCA9IGssIGQgPSBsIC8gazsKICAgICAgICBpbnQgcG9zID0gMDsKICAgICAgICBmb3IoaW50IGkgPSAxOyBpIDw9IHN0ZXA7IGkrKyl7CiAgICAgICAgICAgIGZvcihpbnQgaiA9IHBvcywgdiA9IGQgKyBwb3MgLSAxOyBqIDwgZCArIHBvcyAtIDE7IGorKywgdi0tKXsKCiAgICAgICAgICAgICAgICBpZihzW2pdICE9IHNbdl0pewogICAgICAgICAgICAgICAgICAgIGNvdXQgPDwgIk5PIjsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gMDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBwb3MgKz0gZDsKICAgICAgICB9CiAgICAgICAgY291dCA8PCAiWUVTIjsKICAgIH0KICAgIHJldHVybiAwOwp9