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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)

int main()
{
    lint h,w;cin >> h>>w;
    vector<string> s(h);
    REP(i,h){
        cin >> s[i];
    }
    vector<int> dx{1, 1, 0, 0}, dy{0, 1, 1, 0};
    lint ans = 0;
    REP(i,h-1)REP(j,w-1){
        lint cnt = 0;
        REP(k,4){
            if (s[i+dx[k]][j+dy[k]] == '#')
                cnt++;
        }
        if (cnt == 1||cnt==3){
            ans++;
        }
    }
    cout << ans << "\n";
    return 0;
}
#include<bits/stdc++.h>
#define re register
#define N 2001001
#define MAX 2001
using namespace std;
typedef long long ll;
typedef double db;
const ll mod=998244353;
inline void read(re ll &ret)
{
	ret=0;re char c=getchar();re bool pd=false;
	while(!isdigit(c)){pd|=c=='-';c=getchar();}
	while(isdigit(c)){ret=(ret<<1)+(ret<<3)+(c&15);c=getchar();}
	ret=pd?-ret:ret;
	return;
}
ll n,w,x[N],y[N],z[N],a[N];
signed main()
{
	read(n);
	read(w);
	for(re int i=1;i<=n;i++)
	{
		read(x[i]);
		read(y[i]);
		read(z[i]);
		a[x[i]]+=z[i];
		a[y[i]]-=z[i];
	}
	for(re int i=1;i<=200000;i++)
		a[i]+=a[i-1];
	for(re int i=0;i<=200000;i++)
	{
		if(a[i]>w)
		{
			puts("No");
			exit(0);
		}
	}
	puts("Yes");
	exit(0);
}