#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int n, a;
  while (cin >> s >> n) {
    a = s.length();
    if (a % n != 0)
      cout << "NO" << endl;
    else {
      int b, c = 0;
      b = a / n;
      for (int i = 0; i < a; i += b) {
        for (int j = 0; j < b / 2; j++) {
          if (s[i + j] != s[i + b - j - 1]) {
            c = 1;
            break;
          }
        }
        if (c == 1) break;
      }
      if (c == 1)
        cout << "NO" << endl;
      else
        cout << "YES" << endl;
    }
  }
  return 0;
}
