#include <bits/stdc++.h>
using namespace std;
int n, i, k, b, a = 0;
string s, s1, s2;
double c;
int main() {
  cin >> s >> n;
  c = s.size() % n;
  if (c) {
    cout << "NO";
    return 0;
  }
  k = s.size() / n;
  b = k;
  for (i = 0; i < n; i++) {
    s1 = s.substr(a, b);
    a += k;
    s2 = s1;
    reverse(s2.begin(), s2.end());
    if (s1 != s2) {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
}
