#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int x;
  cin >> s >> x;
  for (int i = 0; i < s.size(); i += s.size() / x) {
    string t, h;
    t = s.substr(i, (s.size() / x));
    h = t;
    reverse(t.begin(), t.end());
    if (h != t || s.size() % x != 0) return cout << "NO", 0;
  }
  cout << "Yes";
}
