#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int k;
  cin >> s;
  cin >> k;
  if (s.length() % k != 0) {
    cout << "NO\n";
    return 0;
  }
  int n = s.length() / k;
  bool con = 0;
  for (int i = int(0); i <= int(k - 1); i++) {
    int l = i * n;
    int r = l + n - 1;
    while (l < r) {
      if (s[l] != s[r]) {
        con = 1;
        break;
      }
      l++;
      r--;
    }
    if (con) break;
  }
  if (!con)
    cout << "YES\n";
  else
    cout << "NO\n";
  return 0;
}
