#include <bits/stdc++.h>
using namespace std;
string s;
int main() {
  bool p = true;
  int n;
  cin >> s >> n;
  if (s.length() % n == 0) {
    for (int i = 0; i < n; i++) {
      for (int k = 0; k < s.length() / n / 2; k++)
        if (s[i * s.length() / n + k] != s[(i + 1) * s.length() / n - k - 1])
          p = false;
    }
    if (p)
      cout << "YES";
    else
      cout << "NO";
  } else
    cout << "NO";
}
