#include <bits/stdc++.h>
char lin[1024];
int N, K, lenSection;
bool isPalin(int st, int fn) {
  for (int i = 0; i < lenSection / 2; i++) {
    if (lin[st + i] != lin[fn - i]) {
      return false;
    }
  }
  return true;
}
int main() {
  scanf("%s\n%d", lin, &K);
  N = strlen(lin);
  if (N % K != 0) {
    printf("NO\n");
    return 0;
  }
  lenSection = N / K;
  for (int i = 0; i < K; i++) {
    if (!isPalin(i * lenSection, (i + 1) * lenSection - 1)) {
      printf("NO\n");
      return 0;
    }
  }
  printf("YES\n");
  return 0;
}
