#include <bits/stdc++.h>
using namespace std;
int compare(const void *a, const void *b) { return (*(int *)a - *(int *)b); }
int main() {
  char str[1002];
  int n, i, j;
  cin >> str;
  cin >> n;
  int x = strlen(str) / n;
  int l = 0, r = x - 1, flag = 0;
  if (strlen(str) % n == 0) {
    for (i = 0; i < n; i++) {
      int temp = r;
      for (j = l; j <= r; j++) {
        if (str[j] != str[temp]) {
          flag = 1;
          break;
        }
        temp--;
      }
      l = l + x;
      r = r + x;
      if (flag == 1) break;
    }
  } else {
    flag = 1;
  }
  if (flag == 1)
    cout << "NO";
  else
    cout << "YES";
  return 0;
}
