#include <bits/stdc++.h>
using namespace std;
string str;
bool check(int lo, int hi) {
  while (lo <= hi) {
    if (str[lo] != str[hi]) return false;
    lo++;
    hi--;
  }
  return true;
}
string ans[2] = {"NO", "YES"};
int main() {
  int k;
  cin >> str >> k;
  if (str.size() % k != 0) {
    puts("NO");
  } else {
    int len = (int)str.size() / k;
    int lo = 0, hi = -1;
    bool ok = true;
    for (int i = len - 1; i < str.size(); i += len) {
      lo = hi + 1;
      hi = i;
      if (!check(lo, hi)) {
        ok = false;
        break;
      }
    }
    cout << ans[ok] << endl;
  }
  return 0;
}
