#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, x, y;
  long long i, l, k, c, flag;
  cin >> s;
  cin >> k;
  l = s.length();
  c = 0;
  flag = 0;
  if (l % k == 0) {
    for (i = 0; i < l; i++) {
      c++;
      x += s[i];
      y = s[i] + y;
      if (c == l / k) {
        if (x.compare(y) != 0) {
          flag = 1;
          break;
        } else {
          x = "";
          y = "";
          c = 0;
        }
      }
    }
  } else
    flag = 1;
  if (flag)
    cout << "NO" << endl;
  else
    cout << "YES" << endl;
  return 0;
}
