#include <iostream>
using namespace std;

int main(){
    int n,m;
    cin >> n >> m;
    cout << (m % n? "No":"Yes") << endl;
}

#include <bits/stdc++.h>
using namespace std;

int n;
string s;

int solve();

int main() {
  cin >> n >> s;
  cout << solve() << endl;
  return 0;
}

int solve() {
  if (s[0] != s[n - 1]) return 1;
  for (int i = 2; i < n; ++i)
    if (s[0] != s[i - 1] && s[0] != s[i]) return 2;
  return -1;
}