#include <bits/stdc++.h>
bool is_palindrome(std::string::iterator begin, std::string::iterator end) {
  std::string::iterator end_string = end + 1;
  while (begin != end && begin != end_string) {
    if (*begin != *end) {
      return false;
    } else {
      ++begin;
      --end;
    }
  }
  return true;
}
int main() {
  std::string messages;
  int k;
  int split;
  bool palindrome;
  std::cin >> messages;
  std::vector<std::string> strings;
  std::cin >> k;
  std::string::iterator begin = messages.begin();
  std::string new_string;
  split = messages.size() / k;
  palindrome = messages.size() % k == 0 ? true : false;
  while (begin != messages.end() && palindrome) {
    palindrome = is_palindrome(begin, begin + split - 1);
    begin = begin + split;
  }
  std::string answer = palindrome ? "YES" : "NO";
  std::cout << answer << std::endl;
  return 0;
}
