#include <bits/stdc++.h>
using namespace std;
int arr[1000000], ans, brr[1000000], num, len, n, m, a, b, k, sum, cnt, keep, w,
    x, y, z, l, r;
bool check;
string S;
int j;
bool ispal(int i) {
  string temp = S.substr(i, j);
  string t = temp;
  reverse(temp.begin(), temp.end());
  if (t == temp) return 1;
  return 0;
}
int main() {
  cin >> S >> k;
  len = S.size();
  if (len % k == 0) {
    j = len / k;
    for (int i = 0; i < len; i += j) {
      if (!ispal(i)) {
        puts("NO");
        return 0;
      }
    }
    puts("YES");
    return 0;
  } else
    puts("NO");
  return 0;
}
