#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k = 0;
  string s;
  cin >> s >> n;
  vector<char> v, vv;
  int len = s.size();
  if (len % n != 0) {
    cout << "NO" << endl;
    return 0;
  }
  int cnt = 0, c = 0, j;
  int m = len / n;
  for (int i = 0; i < n; i++) {
    v.clear();
    vv.clear();
    for (j = c; j < len; j++) {
      v.push_back(s[j]);
      vv.push_back(s[j]);
      cnt++;
      c++;
      if (cnt == m) break;
    }
    cnt = 0;
    int pnt = 0;
    reverse(vv.begin(), vv.end());
    int ln = v.size();
    for (int i = 0; i < ln; i++) {
      if (v[i] == vv[i]) pnt++;
      if (pnt == ln) {
        k++;
      }
    }
    v.clear();
    vv.clear();
  }
  if (k == n) {
    k = 0;
    cout << "YES" << endl;
  } else {
    k = 0;
    cout << "NO" << endl;
  }
  return 0;
}
