#include <bits/stdc++.h>
using namespace std;
const int MaxN = int(1e5) + 123;
int n, m, a[100];
string s, S, t;
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> s >> n;
  S = "";
  if (s.size() % n != 0) {
    cout << "NO";
    return 0;
  }
  m = s.size() / n;
  for (int i = 0; i < s.size(); i++) {
    S += s[i];
    if ((i + 1) % (m) == 0 && (i + 1) >= (m)) {
      t = S;
      reverse(S.begin(), S.end());
      if (t != S) {
        cout << "NO";
        return 0;
      }
      S = "";
    }
  }
  cout << "YES";
  return 0;
}
