#include <bits/stdc++.h>
using namespace std;
bool is_pal(string S) {
  string AB = S;
  reverse(S.begin(), S.end());
  return S == AB;
}
int main() {
  string second;
  int k;
  cin >> second;
  cin >> k;
  int l = second.size();
  if (l % k || k > l)
    cout << "NO";
  else {
    int pal_l = l / k;
    for (int i = 0; i < l; i += pal_l) {
      string tmp = second.substr(i, pal_l);
      if (is_pal(tmp) == 0) {
        cout << "NO";
        return 0;
      }
    }
    cout << "YES\n";
  }
  return 0;
}
