#include <bits/stdc++.h>
using namespace std;
const long long mod = (long long)1e9 + 7;
void solve() {
  string s;
  cin >> s;
  int k;
  cin >> k;
  int n = s.length();
  if (n % k != 0) {
    cout << "NO" << '\n';
    return;
  }
  int m = n / k;
  bool ans = true;
  for (int i = 0; i < n; i += m) {
    string temp = s.substr(i, m);
    bool tem = true;
    for (int j = 0; j < m / 2; j++) {
      if (temp[j] != temp[m - j - 1]) {
        tem = false;
        break;
      }
    }
    if (!tem) {
      ans = false;
      break;
    }
  }
  if (ans) {
    cout << "YES" << '\n';
  } else {
    cout << "NO" << '\n';
  }
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int T;
  T = 1;
  while (T--) {
    solve();
  }
}
