#include <bits/stdc++.h>
using namespace std;
const int N = 110;
int k;
string s;
int main() {
  cin >> s >> k;
  int len = s.length() / k;
  if (s.length() % k) {
    cout << "NO";
    return 0;
  }
  for (int i = 0; i < s.length(); i++) {
    if (s[i] != s[i / len * len + len - 1 - i % len]) {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
  return 0;
}
