#include <bits/stdc++.h>
using namespace std;
int main() {
  string bag;
  int k;
  cin >> bag >> k;
  int wl;
  if (bag.size() % k != 0) {
    cout << "NO" << endl;
    return 0;
  }
  int flag = 0;
  string pal1, pal2;
  wl = bag.size() / k;
  for (int i = 0; i < bag.size(); i++) {
    if (i % wl == 0) {
      pal2 = pal1;
      reverse(pal2.begin(), pal2.end());
      if (pal1 != pal2) {
        flag = 1;
      }
      pal1.clear();
    }
    pal1.push_back(bag[i]);
  }
  pal2 = pal1;
  reverse(pal2.begin(), pal2.end());
  if (pal1 != pal2) {
    flag = 1;
  }
  if (flag) {
    cout << "NO" << endl;
  } else {
    cout << "YES" << endl;
  }
  return 0;
}
