#include <bits/stdc++.h>
using namespace std;
bool is(string s) {
  int len = s.size();
  int lp = 0, rp = len - 1;
  while (lp <= rp) {
    if (s[lp] == s[rp]) {
      lp++;
      rp--;
    } else {
      return false;
    }
  }
  return true;
}
int main() {
  string s = "";
  cin >> s;
  int k, count = 0;
  scanf("%d", &k);
  int n = s.size();
  if (n % k != 0) {
    printf("NO\n");
    return 0;
  }
  int len = n / k;
  for (int i = 0; i < n; i += len) {
    string ans = "";
    for (int j = 0; j < len; j++) {
      ans += s[i + j];
    }
    if (is(ans)) {
      count++;
    }
  }
  if (count == k) {
    printf("YES\n");
  } else {
    printf("NO\n");
  }
  return 0;
}
