#include <bits/stdc++.h>
using namespace std;
bool pal(string s, int start, int end) {
  if (s[start] != s[end])
    return 0;
  else if (start >= end)
    return 1;
  else
    return pal(s, ++start, --end);
  return 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string merged;
  cin >> merged;
  int parts;
  cin >> parts;
  int sz = merged.size();
  if (sz % parts != 0) {
    cout << "NO" << endl;
  } else {
    int i = 0, loc = 0;
    int div = sz / parts;
    while (i < parts) {
      if (pal(merged.substr(loc, div), 0, div - 1)) {
        loc += div;
      } else {
        cout << "NO" << endl;
        return 0;
      }
      i++;
    }
    cout << "YES" << endl;
  }
  return 0;
}
