#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int k;
  cin >> s >> k;
  int ss = s.size(), z = ss / k, q, t = 0, sum = 0;
  if (ss % k != 0) {
    cout << "NO" << endl;
    return 0;
  }
  for (int i = 0; i < ss; i = i + z) {
    q = 1;
    t = 0;
    for (int j = i; j < i + z; j++) {
      if (s[j] == s[i + z - q]) {
        t++;
      }
      q++;
    }
    if (t == z) {
      sum++;
    }
  }
  if (sum == k) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}
