#include <bits/stdc++.h>
using namespace std;
bool check(vector<char> v) {
  int i, j = 0;
  for (i = 0; i < v.size() / 2; i++) {
    if (v[i] != v[v.size() - 1 - i]) {
      j++;
      break;
    }
  }
  if (j == 0)
    return true;
  else
    return false;
}
int main() {
  int n, i, j = 0, k;
  string s, s1;
  vector<char> v;
  cin >> s;
  cin >> n;
  if (s.length() % n == 0) {
    k = 0;
    while (k != s.length()) {
      for (i = k; i < k + s.length() / n; i++) {
        v.push_back(s[i]);
      }
      if (!check(v)) {
        j++;
        break;
      }
      k += s.length() / n;
      v.clear();
    }
    if (j == 0)
      cout << "YES";
    else
      cout << "NO";
  } else
    cout << "NO";
  return 0;
}
