#include <bits/stdc++.h>
int main() {
  std::string s;
  std::cin >> s;
  int k;
  std::cin >> k;
  if (s.length() % k != 0) {
    std::cout << "NO\n";
    return 0;
  }
  int len = s.length() / k;
  for (int i = 0; i < s.length(); i += len) {
    for (int j = i, k = i + len - 1; j < k; ++j, --k) {
      if (s[j] != s[k]) {
        std::cout << "NO\n";
        return 0;
      }
    }
  }
  std::cout << "YES\n";
}
