#include <bits/stdc++.h>
using namespace std;
char s[1001];
int main(void) {
  int k, l, r, i, j;
  cin >> s >> k;
  l = strlen(s);
  r = l / k;
  if (l % k != 0) {
    cout << "NO" << endl;
    return 0;
  }
  for (i = 0; i < l; i += r)
    for (j = 0; j < r / 2; j++) {
      if (s[i + j] != s[i + r - j - 1]) {
        cout << "NO" << endl;
        return 0;
      }
    }
  cout << "YES" << endl;
  return 0;
}
