#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  cin >> str;
  int k;
  cin >> k;
  int n = (int)str.size() / k;
  bool ans = true;
  if (n * k != (int)str.size() || k > (int)str.size()) ans = false;
  for (int i = 0; i < str.size() && ans;) {
    for (int j = 0; j < n; j++)
      if (str[i + j] != str[i + n - 1 - j]) ans = false;
    i += n;
  }
  if (ans)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
