#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  string s;
  int n, len, i;
  cin >> s;
  cin >> n;
  len = s.size();
  if (len % n) {
    cout << "NO" << endl;
  } else {
    int each = len / n;
    int j = 0;
    string temp, temp1;
    int fl = 0;
    for (i = 0; i < n; i++) {
      temp = s.substr(j, each);
      temp1 = string(temp.rbegin(), temp.rend());
      if (temp != temp1) {
        fl = 1;
        break;
      }
      j = j + each;
    }
    if (fl) {
      cout << "NO" << endl;
    } else {
      cout << "YES" << endl;
    }
  }
  return 0;
}
