#include <bits/stdc++.h>
using namespace std;
bool ispalindrome(string st) {
  stack<char> s;
  for (long long i = 0; i < st.size(); i++) s.push(st[i]);
  for (long long i = 0; i < st.size(); i++) {
    if (st[i] != s.top()) return false;
    s.pop();
  }
  return true;
}
int main() {
  string s;
  int k;
  cin >> s;
  cin >> k;
  int g = s.size();
  if (s.size() % k != 0) return cout << "NO", 0;
  int n = s.size() / k;
  for (int i = 0; i < s.size(); i += n) {
    string second = "";
    for (int j = i; j < i + n; j++) second += s[j];
    if (!ispalindrome(second)) return cout << "NO", 0;
  }
  cout << "YES";
  return 0;
}
