#include <bits/stdc++.h>
using namespace std;
int main() {
  char s[1005];
  int k, f = 0, b;
  scanf("%s", s);
  scanf("%d", &k);
  int t = strlen(s);
  if (t % k != 0) {
    printf("NO");
  } else {
    int x = t / k;
    b = 0;
    while (b < t) {
      for (int i = b, j = b + x - 1; i < b + x && j >= b; i++, j--) {
        if (s[j] == s[i])
          f = 1;
        else {
          f = 0;
          break;
        }
      }
      if (f == 0) break;
      b += x;
    }
    if (f == 1)
      printf("YES");
    else
      printf("NO");
  }
  return 0;
}
