题目链接:https://ac.nowcoder.com/acm/contest/297/D
#include<iostream>
#include<cstring>
#include<string>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<ctime>
typedef long long int ll;
using namespace std;
const double INF=1e8;
const double eps=0.0001;
const double pi=acos(-1.0);
const int inf = 0x3f3f3f3f;
const int maxn = 100005;
const ll mod = 998244353;
ll n,m;
ll a[maxn];
ll k;
int main(){
cin>>n>>m;
for(int i=1; i<=n; i++)
cin>>a[i];
k = 0;
sort(a+1, a+n+1);
int flag = 1;
for(int i=1; i<=n; i++)
if(a[i] <= k+1){
k += a[i];
}
else{
flag = 0;
break;
}
if(k >= m)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
return 0;
}