#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m;
  cin >> n >> m;
  long long int **arr;
  char X;
  arr = new long long int *[n];
  for (long long int k = 0; k < n; k++) arr[k] = new long long int[m];
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < m; j++) {
      cin >> X;
      if (X == '.') {
        arr[i][j] = 0;
      } else {
        arr[i][j] = 1;
      }
    }
  }
  long long int sumN = 0, sumM = 0;
  long long int sN = 0, sM = 0;
  for (long long int i = 0; i < n; i++) {
    sN = 0;
    for (long long int j = 0; j < m; j++) {
      sN += arr[i][j];
    }
    if (sN > 0) {
      if (sumN > 0) {
        if (sumN != sN) {
          cout << "NO";
          return 0;
        }
      } else {
        sumN = sN;
      }
    }
  }
  sumN = 0;
  for (long long int i = 0; i < m; i++) {
    sN = 0;
    for (long long int j = 0; j < n; j++) {
      sN += arr[j][i];
    }
    if (sN > 0) {
      if (sumN > 0) {
        if (sumN != sN) {
          cout << "NO";
          return 0;
        }
      } else {
        sumN = sN;
      }
    }
  }
  cout << "YES";
  return 0;
}
