#include <bits/stdc++.h>
using namespace std;
const int mxi = 1e5;
const int mod = 1e9 + 7;
int a, b, c, n[mxi];
string s;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> s >> a;
  if (s.length() % a) {
    cout << "NO";
    return 0;
  }
  a = s.length() / a;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] != s[(i / a * 2 + 1) * a - 1 - i]) {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
}
