#include <bits/stdc++.h>
using namespace std;
int sumR[502];
int sumC[502];
int main() {
  int n, m;
  cin >> n >> m;
  string s;
  int mxR = -1;
  int mxC = -1;
  for (int i = 0; i < n; i++) {
    cin >> s;
    for (int j = 0; j < m; j++) {
      if (s[j] == 'X') {
        sumR[i]++;
        sumC[j]++;
        mxR = max(mxR, sumR[i]);
        mxC = max(mxC, sumC[j]);
      }
    }
  }
  int fl = 1;
  for (int i = 0; i < n; i++) fl = fl and (sumR[i] == mxR or sumR[i] == 0);
  for (int i = 0; i < m; i++) fl = fl and (sumC[i] == mxC or sumC[i] == 0);
  puts((fl) ? "YES" : "NO");
}
