#include <bits/stdc++.h>
using namespace std;
int isPal(string str) {
  int ss = str.size() - 1;
  for (int k = 0; k < str.size() / 2; k++) {
    if (str[k] != str[ss]) return false;
    ss--;
  }
  return true;
}
int main() {
  string s;
  int a, cc = 0;
  cin >> s;
  cin >> a;
  if (s.size() % a == 0) {
    int mov = s.size() / a;
    for (int k = 0; k < s.size(); k += mov) {
      if (!isPal(s.substr(k, mov))) {
        cout << "NO" << endl;
        return 0;
      }
    }
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}
