#include <bits/stdc++.h>
using namespace std;
int main() {
  int k, i, j;
  string a, b = "", c = "";
  bool u = true;
  cin >> a >> k;
  if (a.size() % k != 0)
    cout << "NO";
  else {
    int l = a.size() / k;
    for (i = 0; i < a.size(); i += l) {
      b = "";
      c = "";
      for (j = i; j < l + i; j++) {
        b += a[j];
        c = a[j] + c;
      }
      if (b != c) {
        u = false;
        break;
      }
    }
    if (u)
      cout << "YES";
    else
      cout << "NO";
  }
  return 0;
}
