#include <bits/stdc++.h>
using namespace std;
bool isPalindrome(string &x, int i, int j) {
  while (i < j) {
    if (x.at(i) != x.at(j)) return false;
    i++;
    j--;
  }
  return true;
}
int main() {
  ios::sync_with_stdio(0);
  string x;
  int k, n;
  cin >> x >> k;
  if (x.size() % k == 0) {
    n = x.size() / k;
    bool yes = true;
    for (int i = 0; i < x.size(); i += n) {
      if (!(isPalindrome(x, i, i + n - 1))) {
        yes = false;
        break;
      }
    }
    if (yes)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  } else
    cout << "NO" << endl;
  return 0;
}
