#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int k, i, j, l, f = 0;
  cin >> s >> k;
  if (s.size() % k == 0) {
    for (i = 0; i < s.size(); i += s.size() / k) {
      string x = s.substr(i, s.size() / k);
      for (j = 0, l = x.size() - 1; j < x.size(); j++, l--) {
        if (x[j] != x[l]) {
          f = 1;
          break;
        }
      }
    }
    if (f)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  } else
    cout << "NO" << endl;
  return 0;
}
