#include <bits/stdc++.h>
using namespace std;
bool isplain(string &s) {
  int i = 0, j = s.length() - 1;
  while (i <= j) {
    if (s[i] != s[j]) {
      return false;
    }
    i++, j--;
  }
  return true;
}
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  string s;
  int k;
  cin >> s >> k;
  int n = s.length();
  if (n % k != 0) {
    cout << "NO";
    return 0;
  }
  for (int i = 0; i <= n - (n / k); i += n / k) {
    string r;
    r.assign(s, i, n / k);
    if (!isplain(r)) {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
  return 0;
}
