#include <bits/stdc++.h>
using namespace std;
int brr[100];
int main() {
  string s;
  cin >> s;
  int n, cnt = 0, cnt1 = 0, v;
  cin >> n;
  int len = s.length();
  int num = len / n;
  int start = 0;
  int end = num - 1;
  if (len % n != 0) {
    cout << "NO";
  } else {
    while (n) {
      v = 0;
      while (start < end) {
        if (s[start] == s[end]) {
          start++;
          end--;
          v++;
          continue;
        } else {
          cnt = 1;
          break;
        }
      }
      if (cnt == 1) {
        cout << "NO";
        cnt1++;
        break;
      }
      start -= v;
      end += v;
      start += num;
      end += num;
      n--;
    }
    if (cnt1 == 0) cout << "YES";
  }
  return 0;
}
