#include <bits/stdc++.h>
char aaa[1010];
int main() {
  int s, n, k, flag = 1, i;
  scanf("%s", aaa);
  scanf("%d", &n);
  s = strlen(aaa);
  if (s % n != 0) {
    printf("NO");
    return 0;
  }
  for (k = 0; k < s; k += s / n) {
    for (i = k; i <= k + s / n - 1; i++) {
      if (aaa[i] != aaa[k + s / n - 1 + k - i]) flag = 0;
    }
  }
  if (flag == 1)
    printf("YES");
  else
    printf("NO");
}
