#include <bits/stdc++.h>
using namespace std;
const double pi = 3.141592653689793238460;
const int inf = 0x3f3f3f3f;
const int N = 2e5 + 5;
const int pr = 31;
int mod = 998244353;
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m;
  cin >> n >> m;
  string a[10005];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int ms = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (a[i][j] == 'X') ms++;
    }
  }
  int rs = 0;
  int cs = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (a[i][j] == 'X') {
        rs++;
        break;
      }
    }
  }
  for (int j = 0; j < m; j++) {
    for (int i = 0; i < n; i++) {
      if (a[i][j] == 'X') {
        cs++;
        break;
      }
    }
  }
  if (rs * cs == ms) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}
