#include <bits/stdc++.h>
using namespace std;
string mes[1005];
bool check(string message) {
  string s;
  int len_check = message.length();
  len_check--;
  for (int i = 0; i <= len_check; i++) {
    if (message[i] != message[len_check - i]) return false;
  }
  return true;
}
int main() {
  bool YES = true;
  string s;
  int k;
  cin >> s >> k;
  int len = s.length();
  int per_len = len / k;
  if (len % k != 0) YES = false;
  if (YES)
    for (int i = 0; i < k; i++) {
      mes[i] = s.substr(i * per_len, per_len);
      if (!check(mes[i])) YES = false;
    }
  if (YES)
    puts("YES");
  else
    puts("NO");
  return 0;
}
