#include <bits/stdc++.h>
using namespace std;
long long int fast_pow(long long int base, long long int n, long long int mod) {
  long long int res = 1;
  while (n) {
    if (n & 1) res = (res * base) % mod;
    base = (base * base) % mod;
    n = n >> 1;
  }
  return res;
}
string S;
bool fun(int l, int r) {
  for (int i = l, j = r; i < j; i++, j--) {
    if (S[i] != S[j]) {
      return false;
    }
  }
  return true;
}
int main() {
  int k, l = 0;
  cin >> S;
  cin >> k;
  int s = S.size();
  if (s % k != 0) {
    printf("NO\n");
    return 0;
  }
  int j = s / k - 1;
  for (int i = 0; S[i] != '\0'; i++) {
    char ch = S[i];
    if (fun(i, i + j)) {
      l++;
      i = i + j;
    } else {
      printf("NO\n");
      return 0;
    }
  }
  if (l == k) {
    printf("YES\n");
  } else
    printf("NO\n");
  return 0;
}
