#include <bits/stdc++.h>
using namespace std;
int main() {
  string x, y, z;
  cin >> x;
  long f, s;
  long i, j;
  cin >> f;
  if (x.size() % f != 0) {
    goto h;
  }
  s = x.size() / f;
  for (i = 0; i < x.size(); i += s - 1) {
    for (j = i + s - 1; j >= i; j--) {
      y = y + x.substr(j, 1);
    }
    i++;
  }
  if (y == x) {
    cout << "YES";
  } else {
  h:
    cout << "NO";
  }
}
