#include <bits/stdc++.h>
using namespace std;
template <typename T>
string tostr(const T& t) {
  ostringstream os;
  os << t;
  return os.str();
}
int main() {
  string s;
  int k;
  cin >> s >> k;
  if ((int)s.size() % k)
    cout << "NO";
  else {
    for (int i = 0; i < (int)s.size(); i += (int)s.size() / k) {
      string t = s.substr(i, (int)s.size() / k);
      string t2 = t;
      reverse((t2).begin(), (t2).end());
      if (t != t2) {
        cout << "NO";
        goto byebye;
      }
    }
    cout << "YES";
  }
byebye:;
  return 0;
}
