#include <bits/stdc++.h>
using namespace std;
bool is_palindrome(string s) {
  long long int n = s.length();
  for (long long int i = 0; i < n / 2; i++) {
    if (s[i] != s[n - i - 1]) return false;
  }
  return true;
}
int main() {
  string s;
  long long int k;
  cin >> s >> k;
  bool yes = true;
  for (long long int i = 0; i < k; i++) {
    long long int n = s.length() / k;
    if (!is_palindrome(s.substr(i * n, n))) yes = false;
  }
  if ((yes) && (s.length() % k == 0))
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
