#include <bits/stdc++.h>
using namespace std;
string second;
long long int k;
long long int len;
long long int l, r;
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> (second) >> (k);
  len = second.size() / k;
  if (second.size() % k != 0) {
    cout << ("NO") << endl;
    return 0;
  }
  for (long long int i = 0; i < k; i++) {
    l = i * len;
    r = (i + 1) * len - 1;
    long long int iniL = l;
    for (; r >= iniL; l++, r--) {
      if (second[l] != second[r]) {
        cout << ("NO") << endl;
        return 0;
      }
    }
  }
  cout << ("YES") << endl;
  return 0;
}
