#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  long int l, n, i, k, m;
  cin >> n;
  l = s.length();
  k = l / n;
  int f = 1;
  if (l % n != 0) {
    f = 0;
  } else {
    for (int j = 0; j < n; j++) {
      for (i = j * k, m = (j + 1) * k; i < (j + 1) * k; i++, m--) {
        if (s[i] != s[m - 1]) {
          f = 0;
          break;
        }
      }
    }
  }
  if (f == 0)
    cout << "NO";
  else
    cout << "YES";
}
