#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int n;
  int k = 0;
  cin >> n;
  int x = s.length() / n;
  if (x * n != s.length()) {
    cout << "NO" << endl;
    exit(0);
  }
  for (int i = 1; i <= n; i++) {
    k = 0;
    int z = x * (i - 1);
    for (int j = z; j < z + x / 2 + x % 2; j++) {
      k++;
      if (s[j] != s[z + x - k]) {
        cout << "NO" << endl;
        exit(0);
      }
    }
  }
  cout << "YES" << endl;
  return 0;
}
