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