#include <bits/stdc++.h>
using namespace std;
int k;
string s;
bool kt(string s1) {
  int l = 0, r = s1.length() - 1;
  while (s1[l] == s1[r]) {
    r--;
    l++;
  }
  if (l < r)
    return 0;
  else
    return 1;
}
int main() {
  cin >> s >> k;
  if (s.length() % k != 0) {
    cout << "NO";
    return 0;
  }
  int m = s.length() / k;
  for (int i = 0; i <= s.length() - m; i += m) {
    string s2 = s.substr(i, m);
    if (kt(s2) == 0) {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
}
