#include <bits/stdc++.h>
using namespace std;
string cadena;
bool isPal(int s, int f) {
  f--;
  while (f > s) {
    if (cadena[s] != cadena[f]) {
      return false;
    }
    s++;
    f--;
  }
  return true;
}
int main() {
  int k;
  cin >> cadena >> k;
  if (cadena.size() % k != 0) {
    cout << "NO" << endl;
    return 0;
  }
  int n = cadena.size() / k;
  for (int i = 0; i < k; i++) {
    if (!isPal(i * n, i * n + n)) {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
}
