#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
bool f(string s) {
  string t = s;
  reverse(t.begin(), t.end());
  return (int)t.size() == (int)s.size() && t == s;
}
int main() {
  string s, t;
  int n, k;
  cin >> s >> k;
  s = '#' + s;
  n = (int)s.size() - 1;
  if (n % k) return cout << "NO\n", 0;
  for (int i = 1; i <= n; ++i) {
    t += s[i];
    if ((int)t.size() == n / k) {
      if (!f(t)) return cout << "NO", 0;
      t = "";
    }
  }
  cout << "YES";
}
