#include <bits/stdc++.h>
using namespace std;
bool ispalindrom(string s) {
  string rs;
  reverse(s.begin(), s.end());
  rs = s;
  reverse(s.begin(), s.end());
  if (rs == s)
    return true;
  else
    return false;
}
int main() {
  string s;
  int k;
  cin >> s >> k;
  int n = s.length();
  if (n % k != 0) {
    cout << "NO";
    return 0;
  }
  int i = n / k, count = 0;
  for (int j = 0; j + i <= n; j += i) {
    string temp = s.substr(j, i);
    if (!ispalindrom(temp)) {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
}
