### My issue

### My code

```
#include <iostream>
using namespace std;
int main() {
// your code goes here
int t,n,x;
cin>>t;
while(t--){
cin>>n>>x;
int a[n];
int sum=0;
for(int i=0;i<n;i++){
sum+=a[i];
if(sum>k){
}
}
}
return 0;
}
```

Problem Link: CodeChef: Practical coding for everyone

@deepakjdh31

The logic is if u found any two pair that are not in order then the maximum sum will be the sum of last and second last maximum number and if their sum is lesser than x then it would be possible else it is not possible .

i have coded my logic in much simpler way hope u will get it.

```
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t--)
{
int n,x;
cin>>n>>x;
int a[n];
int mx=0,ans=0;
for(int i=0;i<n;i++)
{
cin>>a[i];
if(a[i]<mx)
{
ans=max(ans,mx+a[i]);
}
else
mx=max(mx,a[i]);
}
if(ans<=x)
cout<<"YES";
else
cout<<"NO";
cout<<endl;
}
return 0;
}
```