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