#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  long long n = s.size();
  long long k;
  cin >> k;
  long long kk = n / k;
  if (s.size() % k != 0) {
    cout << "NO\n";
    return 0;
  } else {
    for (int i = 0; i < n; i += kk) {
      long long p = i + kk - 1;
      for (int j = 0; j < kk; j++) {
        if (s[i + j] != s[p - j]) {
          cout << "NO\n";
          return 0;
        }
      }
    }
    cout << "YES\n";
  }
}
