#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int a;
  cin >> a;
  int k = s.size() / a;
  if (a * k != s.size()) {
    cout << "NO";
    exit(0);
  }
  int l = 0;
  while (l + k <= s.size()) {
    int j = l + k - 1;
    for (int i = l; i < l + k; i++) {
      if (j <= i) break;
      if (s[i] != s[j]) {
        cout << "NO";
        exit(0);
      }
      j--;
    }
    l += k;
  }
  cout << "YES";
}
