#include <bits/stdc++.h>
using namespace std;
bool cmp(int a, int b) { return a > b; }
int main() {
  string s;
  int k, n;
  cin >> s >> k;
  n = s.size();
  int len = n / k;
  for (int i = 0; i < n; i++)
    if (n % k or s[i] != s[(i / len) * len + len - 1 - (i % len)]) {
      cout << "NO" << endl;
      return 0;
    }
  cout << "YES" << endl;
  return 0;
}
