#include <bits/stdc++.h>
using namespace std;
string s;
bool check(int p, int u) {
  while (p < u) {
    if (s[p] != s[u]) return 0;
    ++p;
    --u;
  }
  return 1;
}
int main(void) {
  int n, k;
  cin >> s >> k;
  n = s.length();
  bool ok = 1;
  if (n % k) return cout << "NO\n", 0;
  k = n / k;
  for (int i = 0; i < n; i += k) ok &= check(i, i + k - 1);
  return cout << (ok ? "YES" : "NO") << '\n', 0;
}
